From 4c39fefd1ed3b65a18352a14d71ff01fc426b004 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 3 Jul 2012 12:30:50 +0200 Subject: [PATCH] Issue #107: World is accessed only through the interface class from now on; some include cleanup --- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/engine.cpp | 3 +- apps/openmw/mwbase/environment.cpp | 8 ++-- apps/openmw/mwbase/environment.hpp | 11 ++--- apps/openmw/mwclass/apparatus.cpp | 2 +- apps/openmw/mwclass/armor.cpp | 6 +-- apps/openmw/mwclass/book.cpp | 2 +- apps/openmw/mwclass/clothing.cpp | 2 +- apps/openmw/mwclass/container.cpp | 2 +- apps/openmw/mwclass/door.cpp | 2 +- apps/openmw/mwclass/ingredient.cpp | 2 +- apps/openmw/mwclass/light.cpp | 2 +- apps/openmw/mwclass/lockpick.cpp | 2 +- apps/openmw/mwclass/misc.cpp | 2 +- apps/openmw/mwclass/npc.cpp | 8 ++-- apps/openmw/mwclass/potion.cpp | 2 +- apps/openmw/mwclass/probe.cpp | 2 +- apps/openmw/mwclass/repair.cpp | 2 +- apps/openmw/mwclass/weapon.cpp | 2 +- apps/openmw/mwdialogue/dialoguemanager.cpp | 18 ++++---- apps/openmw/mwdialogue/journal.cpp | 12 +++--- apps/openmw/mwdialogue/journalentry.cpp | 24 +++++------ apps/openmw/mwdialogue/journalentry.hpp | 14 ++----- apps/openmw/mwdialogue/quest.cpp | 17 ++++---- apps/openmw/mwdialogue/quest.hpp | 6 +-- apps/openmw/mwdialogue/topic.cpp | 4 +- apps/openmw/mwdialogue/topic.hpp | 7 +--- apps/openmw/mwgui/alchemywindow.cpp | 4 +- apps/openmw/mwgui/charactercreation.hpp | 6 ++- apps/openmw/mwgui/confirmationdialog.cpp | 2 +- apps/openmw/mwgui/console.cpp | 3 ++ apps/openmw/mwgui/container.cpp | 8 +++- apps/openmw/mwgui/countdialog.cpp | 4 +- apps/openmw/mwgui/hud.cpp | 10 +++-- apps/openmw/mwgui/inventorywindow.cpp | 15 ++++--- apps/openmw/mwgui/journalwindow.cpp | 9 ++-- apps/openmw/mwgui/referenceinterface.cpp | 5 ++- apps/openmw/mwgui/settingswindow.cpp | 6 ++- apps/openmw/mwgui/spellwindow.cpp | 9 +++- apps/openmw/mwgui/stats_window.cpp | 11 +++-- apps/openmw/mwgui/tooltips.cpp | 16 ++++---- apps/openmw/mwgui/tradewindow.cpp | 3 +- apps/openmw/mwmechanics/activespells.cpp | 5 ++- apps/openmw/mwmechanics/mechanicsmanager.cpp | 6 +-- apps/openmw/mwmechanics/spells.cpp | 5 ++- apps/openmw/mwmechanics/spellsuccess.hpp | 6 ++- apps/openmw/mwrender/creatureanimation.cpp | 2 +- apps/openmw/mwrender/debugging.cpp | 16 +++++--- apps/openmw/mwrender/localmap.cpp | 12 +++--- apps/openmw/mwrender/npcanimation.cpp | 5 ++- apps/openmw/mwrender/renderingmanager.cpp | 22 +++++----- apps/openmw/mwrender/sky.cpp | 3 +- apps/openmw/mwrender/terrain.cpp | 8 ++-- apps/openmw/mwrender/terrain.hpp | 2 + apps/openmw/mwscript/aiextensions.cpp | 2 + apps/openmw/mwscript/animationextensions.cpp | 2 +- apps/openmw/mwscript/cellextensions.cpp | 4 +- apps/openmw/mwscript/compilercontext.cpp | 6 ++- apps/openmw/mwscript/controlextensions.cpp | 1 + apps/openmw/mwscript/globalscripts.cpp | 3 ++ apps/openmw/mwscript/interpretercontext.cpp | 4 +- apps/openmw/mwscript/interpretercontext.hpp | 3 +- apps/openmw/mwscript/miscextensions.cpp | 8 ++-- apps/openmw/mwscript/ref.hpp | 2 +- apps/openmw/mwscript/soundextensions.cpp | 3 +- apps/openmw/mwsound/soundmanager.cpp | 4 +- apps/openmw/mwworld/actionequip.cpp | 11 ++--- apps/openmw/mwworld/actionopen.cpp | 7 ++-- apps/openmw/mwworld/actiontake.cpp | 3 +- apps/openmw/mwworld/actionteleport.cpp | 3 +- apps/openmw/mwworld/cells.cpp | 12 +++--- apps/openmw/mwworld/cells.hpp | 23 +++++------ apps/openmw/mwworld/containerstore.cpp | 2 +- apps/openmw/mwworld/inventorystore.cpp | 3 +- apps/openmw/mwworld/physicssystem.cpp | 21 +++++----- apps/openmw/mwworld/player.cpp | 21 +++++----- apps/openmw/mwworld/player.hpp | 10 +++-- apps/openmw/mwworld/scene.cpp | 41 +++++++++---------- apps/openmw/mwworld/scene.hpp | 3 +- apps/openmw/mwworld/weather.cpp | 12 +++--- .../mwworld/{world.cpp => worldimp.cpp} | 6 +-- .../mwworld/{world.hpp => worldimp.hpp} | 4 +- libs/openengine/bullet/CMotionState.cpp | 1 - libs/openengine/bullet/physic.cpp | 3 +- libs/openengine/bullet/trace.h | 5 +-- 85 files changed, 327 insertions(+), 275 deletions(-) rename apps/openmw/mwworld/{world.cpp => worldimp.cpp} (99%) rename apps/openmw/mwworld/{world.hpp => worldimp.hpp} (99%) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 770596c69..9534ecc90 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -47,7 +47,7 @@ add_openmw_dir (mwsound ) 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 cells localscripts customdata weather inventorystore ptr actionopen actionread actionequip timestamp actionalchemy cellstore diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 70e69b99c..45b4ab514 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -38,10 +38,10 @@ #include "mwsound/soundmanager.hpp" -#include "mwworld/world.hpp" #include "mwworld/class.hpp" #include "mwworld/player.hpp" #include "mwworld/cellstore.hpp" +#include "mwworld/worldimp.hpp" #include "mwclass/classes.hpp" @@ -51,6 +51,7 @@ #include "mwmechanics/mechanicsmanager.hpp" #include "mwbase/environment.hpp" +#include "mwbase/world.hpp" void OMW::Engine::executeLocalScripts() diff --git a/apps/openmw/mwbase/environment.cpp b/apps/openmw/mwbase/environment.cpp index 792e240f4..7218f22eb 100644 --- a/apps/openmw/mwbase/environment.cpp +++ b/apps/openmw/mwbase/environment.cpp @@ -9,13 +9,13 @@ #include "../mwsound/soundmanager.hpp" -#include "../mwworld/world.hpp" - #include "../mwdialogue/dialoguemanager.hpp" #include "../mwdialogue/journal.hpp" #include "../mwmechanics/mechanicsmanager.hpp" +#include "world.hpp" + MWBase::Environment *MWBase::Environment::sThis = 0; MWBase::Environment::Environment() @@ -32,7 +32,7 @@ MWBase::Environment::~Environment() sThis = 0; } -void MWBase::Environment::setWorld (MWWorld::World *world) +void MWBase::Environment::setWorld (World *world) { mWorld = world; } @@ -77,7 +77,7 @@ void MWBase::Environment::setFrameDuration (float duration) mFrameDuration = duration; } -MWWorld::World *MWBase::Environment::getWorld() const +MWBase::World *MWBase::Environment::getWorld() const { assert (mWorld); return mWorld; diff --git a/apps/openmw/mwbase/environment.hpp b/apps/openmw/mwbase/environment.hpp index 521beee0a..ad5a6f655 100644 --- a/apps/openmw/mwbase/environment.hpp +++ b/apps/openmw/mwbase/environment.hpp @@ -32,13 +32,10 @@ namespace MWInput struct MWInputManager; } -namespace MWWorld +namespace MWBase { class World; -} -namespace MWBase -{ /// \brief Central hub for mw-subsystems /// /// 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; - MWWorld::World *mWorld; + World *mWorld; MWSound::SoundManager *mSoundManager; MWScript::ScriptManager *mScriptManager; MWGui::WindowManager *mWindowManager; @@ -71,7 +68,7 @@ namespace MWBase ~Environment(); - void setWorld (MWWorld::World *world); + void setWorld (World *world); void setSoundManager (MWSound::SoundManager *soundManager); @@ -90,7 +87,7 @@ namespace MWBase void setFrameDuration (float duration); ///< Set length of current frame in seconds. - MWWorld::World *getWorld() const; + World *getWorld() const; MWSound::SoundManager *getSoundManager() const; diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index 3321ab154..55f5bc11f 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -4,11 +4,11 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionalchemy.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwrender/objects.hpp" diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index c3beed9ea..9e029d005 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -5,15 +5,15 @@ #include #include +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" -#include "../mwbase/environment.hpp" - #include "../mwrender/objects.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index 6ad680b65..780e2e0f5 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -4,10 +4,10 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actionread.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwrender/objects.hpp" diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index c063dd1b1..04a1f3ee6 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -4,12 +4,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/tooltips.hpp" diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 25e00fa3d..0c8682df4 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -4,12 +4,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/customdata.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 6b302f2b6..9148d3575 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -4,12 +4,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/player.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/actionteleport.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index 8bf526e77..bc68e46b2 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -4,10 +4,10 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 61af188c5..9fa11be5e 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -4,13 +4,13 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index 17dfff1e9..b35172f2f 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -4,12 +4,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index ff6acb6b5..1163b43b2 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -6,10 +6,10 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 5d5a59d27..e1b8541a1 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -9,6 +9,9 @@ #include +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/movement.hpp" @@ -16,13 +19,12 @@ #include "../mwworld/ptr.hpp" #include "../mwworld/actiontalk.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/inventorystore.hpp" #include "../mwworld/customdata.hpp" -#include "../mwgui/window_manager.hpp" +#include "../mwrender/actors.hpp" -#include "../mwbase/environment.hpp" +#include "../mwgui/window_manager.hpp" namespace { diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 8b0bbcde8..cd393f388 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -4,10 +4,10 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index feac83787..a8bfdead1 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -4,12 +4,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index e38dc68a5..4a4550ba1 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -4,10 +4,10 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 73e8107fc..90f98afb9 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -4,12 +4,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/cellstore.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwdialogue/dialoguemanager.cpp b/apps/openmw/mwdialogue/dialoguemanager.cpp index 7f0765843..98562c053 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.cpp +++ b/apps/openmw/mwdialogue/dialoguemanager.cpp @@ -10,9 +10,9 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/refdata.hpp" #include "../mwworld/player.hpp" #include "../mwworld/containerstore.hpp" @@ -121,24 +121,24 @@ namespace } template - 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': - return selectCompare (comp, world.getGlobalVariable (name).mShort, value); + return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort, value); case 'l': - return selectCompare (comp, world.getGlobalVariable (name).mLong, value); + return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong, value); case 'f': - return selectCompare (comp, world.getGlobalVariable (name).mFloat, value); + return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat, value); case ' ': - world.getGlobalVariable (name); // trigger exception + MWBase::Environment::get().getWorld()->getGlobalVariable (name); // trigger exception break; default: @@ -309,12 +309,12 @@ namespace MWDialogue if (select.type==ESM::VT_Short || select.type==ESM::VT_Int || 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; } 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; } else diff --git a/apps/openmw/mwdialogue/journal.cpp b/apps/openmw/mwdialogue/journal.cpp index eb828a76c..ad10be3aa 100644 --- a/apps/openmw/mwdialogue/journal.cpp +++ b/apps/openmw/mwdialogue/journal.cpp @@ -2,12 +2,11 @@ #include "journal.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/messagebox.hpp" -#include "../mwworld/world.hpp" - namespace MWDialogue { Quest& Journal::getQuest (const std::string& id) @@ -30,14 +29,13 @@ namespace MWDialogue void Journal::addEntry (const std::string& id, int index) { - StampedJournalEntry entry = - StampedJournalEntry::makeFromQuest (id, index, *MWBase::Environment::get().getWorld()); + StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index); mJournal.push_back (entry); 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 empty; std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str; @@ -48,7 +46,7 @@ namespace MWDialogue { 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) @@ -63,7 +61,7 @@ namespace MWDialogue 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 diff --git a/apps/openmw/mwdialogue/journalentry.cpp b/apps/openmw/mwdialogue/journalentry.cpp index 4eb6b8001..9d58687e1 100644 --- a/apps/openmw/mwdialogue/journalentry.cpp +++ b/apps/openmw/mwdialogue/journalentry.cpp @@ -5,7 +5,8 @@ #include -#include "../mwworld/world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" namespace MWDialogue { @@ -27,16 +28,14 @@ namespace MWDialogue throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic); } - JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world) + JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index) { - return JournalEntry (topic, idFromIndex (topic, index, world)); + return JournalEntry (topic, idFromIndex (topic, index)); } - std::string JournalEntry::idFromIndex (const std::string& topic, int index, - const MWWorld::World& world) + std::string JournalEntry::idFromIndex (const std::string& topic, int index) { - const ESM::Dialogue *dialogue = world.getStore().dialogs.find (topic); + const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (topic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -57,13 +56,12 @@ namespace MWDialogue : JournalEntry (topic, infoId), mDay (day), mMonth (month), mDayOfMonth (dayOfMonth) {} - StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world) + StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index) { - int day = world.getGlobalVariable ("dayspassed").mLong; - int month = world.getGlobalVariable ("day").mLong; - int dayOfMonth = world.getGlobalVariable ("month").mLong; + int day = MWBase::Environment::get().getWorld()->getGlobalVariable ("dayspassed").mLong; + int month = MWBase::Environment::get().getWorld()->getGlobalVariable ("day").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); } } diff --git a/apps/openmw/mwdialogue/journalentry.hpp b/apps/openmw/mwdialogue/journalentry.hpp index 11b715630..9a3270439 100644 --- a/apps/openmw/mwdialogue/journalentry.hpp +++ b/apps/openmw/mwdialogue/journalentry.hpp @@ -8,11 +8,6 @@ namespace ESMS struct ESMStore; } -namespace MWWorld -{ - class World; -} - namespace MWDialogue { /// \brief A quest or dialogue entry @@ -27,11 +22,9 @@ namespace MWDialogue std::string getText (const ESMS::ESMStore& store) const; - static JournalEntry makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world); + static JournalEntry makeFromQuest (const std::string& topic, int index); - static std::string idFromIndex (const std::string& topic, int index, - const MWWorld::World& world); + static std::string idFromIndex (const std::string& topic, int index); }; /// \biref A quest entry with a timestamp. @@ -46,8 +39,7 @@ namespace MWDialogue StampedJournalEntry (const std::string& topic, const std::string& infoId, int day, int month, int dayOfMonth); - static StampedJournalEntry makeFromQuest (const std::string& topic, int index, - const MWWorld::World& world); + static StampedJournalEntry makeFromQuest (const std::string& topic, int index); }; } diff --git a/apps/openmw/mwdialogue/quest.cpp b/apps/openmw/mwdialogue/quest.cpp index 1f387e862..484c2c19c 100644 --- a/apps/openmw/mwdialogue/quest.cpp +++ b/apps/openmw/mwdialogue/quest.cpp @@ -3,7 +3,8 @@ #include -#include "../mwworld/world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" namespace MWDialogue { @@ -15,9 +16,9 @@ namespace MWDialogue : 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::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -32,9 +33,9 @@ namespace MWDialogue 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::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -58,11 +59,11 @@ namespace MWDialogue return mFinished; } - void Quest::addEntry (const JournalEntry& entry, const MWWorld::World& world) + void Quest::addEntry (const JournalEntry& entry) { 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::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -75,7 +76,7 @@ namespace MWDialogue if (index==-1) throw std::runtime_error ("unknown journal entry for topic " + mTopic); - setIndex (index, world); + setIndex (index); for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter) if (*iter==entry.mInfoId) diff --git a/apps/openmw/mwdialogue/quest.hpp b/apps/openmw/mwdialogue/quest.hpp index c162c03f4..5fcc894ea 100644 --- a/apps/openmw/mwdialogue/quest.hpp +++ b/apps/openmw/mwdialogue/quest.hpp @@ -17,17 +17,17 @@ namespace MWDialogue Quest (const std::string& topic); - const std::string getName (const MWWorld::World& world) const; + const std::string getName() const; ///< May be an empty string 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. 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. /// /// \note Redundant entries are ignored, but the index is still adjusted. diff --git a/apps/openmw/mwdialogue/topic.cpp b/apps/openmw/mwdialogue/topic.cpp index 8f165d3c8..8c1dfafb8 100644 --- a/apps/openmw/mwdialogue/topic.cpp +++ b/apps/openmw/mwdialogue/topic.cpp @@ -3,8 +3,6 @@ #include -#include "../mwworld/world.hpp" - namespace MWDialogue { Topic::Topic() @@ -17,7 +15,7 @@ namespace MWDialogue Topic::~Topic() {} - void Topic::addEntry (const JournalEntry& entry, const MWWorld::World& world) + void Topic::addEntry (const JournalEntry& entry) { if (entry.mTopic!=mTopic) throw std::runtime_error ("topic does not match: " + mTopic); diff --git a/apps/openmw/mwdialogue/topic.hpp b/apps/openmw/mwdialogue/topic.hpp index c085f1ed9..3ad15903f 100644 --- a/apps/openmw/mwdialogue/topic.hpp +++ b/apps/openmw/mwdialogue/topic.hpp @@ -6,11 +6,6 @@ #include "journalentry.hpp" -namespace MWWorld -{ - class World; -} - namespace MWDialogue { /// \brief Collection of seen responses for a topic @@ -34,7 +29,7 @@ namespace MWDialogue virtual ~Topic(); - virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world); + virtual void addEntry (const JournalEntry& entry); ///< Add entry /// /// \note Redundant entries are ignored. diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 6fedc8d1d..1267109b8 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -3,10 +3,12 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/player.hpp" #include "../mwworld/manualref.hpp" #include "../mwworld/containerstore.hpp" + #include "../mwsound/soundmanager.hpp" #include "window_manager.hpp" diff --git a/apps/openmw/mwgui/charactercreation.hpp b/apps/openmw/mwgui/charactercreation.hpp index 02b48ffe2..e9c90877e 100644 --- a/apps/openmw/mwgui/charactercreation.hpp +++ b/apps/openmw/mwgui/charactercreation.hpp @@ -3,10 +3,12 @@ #include "window_manager.hpp" +#include + +#include "../mwbase/world.hpp" + #include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/stat.hpp" -#include "../mwworld/world.hpp" -#include namespace MWGui { diff --git a/apps/openmw/mwgui/confirmationdialog.cpp b/apps/openmw/mwgui/confirmationdialog.cpp index 5e12c3296..8663c141b 100644 --- a/apps/openmw/mwgui/confirmationdialog.cpp +++ b/apps/openmw/mwgui/confirmationdialog.cpp @@ -3,7 +3,7 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" namespace MWGui { diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 8115835f4..5fc9b6c96 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -3,6 +3,9 @@ #include +#include +#include + #include #include "../mwscript/extensions.hpp" diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 1d4c70de2..0d168a147 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -3,19 +3,23 @@ #include #include #include -#include +#include #include #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/manualref.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" #include "../mwworld/player.hpp" + #include "../mwclass/container.hpp" + #include "../mwinput/inputmanager.hpp" + #include "../mwsound/soundmanager.hpp" #include "window_manager.hpp" diff --git a/apps/openmw/mwgui/countdialog.cpp b/apps/openmw/mwgui/countdialog.cpp index e0a9bb908..72064efaa 100644 --- a/apps/openmw/mwgui/countdialog.cpp +++ b/apps/openmw/mwgui/countdialog.cpp @@ -3,7 +3,7 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" namespace MWGui { @@ -77,7 +77,7 @@ namespace MWGui { if (_sender->getCaption() == "") return; - + unsigned int count; try { diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 4ad9845f0..ebba1661b 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -7,11 +7,13 @@ #include #include "../mwbase/environment.hpp" -#include "../mwsound/soundmanager.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" +#include "../mwsound/soundmanager.hpp" + #include "inventorywindow.hpp" #include "window_manager.hpp" #include "container.hpp" @@ -239,7 +241,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender) // drop item into the gameworld MWWorld::Ptr object = *mDragAndDrop->mDraggedWidget->getUserData(); - MWWorld::World* world = MWBase::Environment::get().getWorld(); + MWBase::World* world = MWBase::Environment::get().getWorld(); MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); 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 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. bool canDrop = world->canPlaceObject(mouseX, mouseY); diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index a26a958bd..b32832f86 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -3,21 +3,24 @@ #include #include #include -#include -#include +#include #include -#include "../mwclass/container.hpp" +#include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" + #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" -#include "../mwbase/environment.hpp" #include "../mwworld/manualref.hpp" #include "../mwworld/actiontake.hpp" +#include "../mwworld/inventorystore.hpp" + #include "../mwsound/soundmanager.hpp" +#include "../mwclass/container.hpp" + #include "window_manager.hpp" #include "widgets.hpp" #include "bookwindow.hpp" @@ -171,7 +174,7 @@ namespace MWGui /// \todo scripts boost::shared_ptr action = MWWorld::Class::get(ptr).use(ptr); - + action->execute(); // this is necessary for books/scrolls: if they are already in the player's inventory, diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 7f9000bc7..e49879b0b 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -1,11 +1,14 @@ #include "journalwindow.hpp" -#include "window_manager.hpp" -#include "../mwdialogue/journal.hpp" + #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + +#include "../mwdialogue/journal.hpp" #include "../mwsound/soundmanager.hpp" +#include "window_manager.hpp" + namespace { struct book diff --git a/apps/openmw/mwgui/referenceinterface.cpp b/apps/openmw/mwgui/referenceinterface.cpp index c6e710952..f891b3338 100644 --- a/apps/openmw/mwgui/referenceinterface.cpp +++ b/apps/openmw/mwgui/referenceinterface.cpp @@ -1,9 +1,10 @@ #include "referenceinterface.hpp" -#include "../mwworld/player.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" +#include "../mwworld/player.hpp" + namespace MWGui { ReferenceInterface::ReferenceInterface() diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 6ceed664e..3f2205728 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -11,8 +11,12 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + +#include "../mwrender/renderingmanager.hpp" + #include "../mwsound/soundmanager.hpp" + #include "../mwinput/inputmanager.hpp" #include "window_manager.hpp" diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 909798f1a..5bca77e61 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -4,13 +4,18 @@ #include #include -#include "../mwworld/world.hpp" +#include + +#include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" + #include "../mwworld/player.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwbase/environment.hpp" + #include "../mwmechanics/spells.hpp" #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/spellsuccess.hpp" + #include "../mwsound/soundmanager.hpp" #include "window_manager.hpp" diff --git a/apps/openmw/mwgui/stats_window.cpp b/apps/openmw/mwgui/stats_window.cpp index 3584af7c7..87b0c27fb 100644 --- a/apps/openmw/mwgui/stats_window.cpp +++ b/apps/openmw/mwgui/stats_window.cpp @@ -6,10 +6,13 @@ #include -#include "../mwmechanics/mechanicsmanager.hpp" -#include "../mwworld/world.hpp" -#include "../mwworld/player.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 "tooltips.hpp" @@ -539,7 +542,7 @@ void StatsWindow::updateSkillArea() skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "TextToolTip"); skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sSkillsMenuReputationHelp}"); } - + addValueItem(mWindowManager.getGameSettingString("sBounty", "Bounty"), boost::lexical_cast(static_cast(bounty)), "normal", coord1, coord2); diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 7ec444168..e79436adc 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -1,15 +1,17 @@ #include "tooltips.hpp" -#include "window_manager.hpp" -#include "widgets.hpp" -#include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" -#include "../mwbase/environment.hpp" - #include #include +#include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" + +#include "../mwworld/class.hpp" + +#include "window_manager.hpp" +#include "widgets.hpp" + using namespace MWGui; using namespace MyGUI; @@ -392,7 +394,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info) /** * \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. */ diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 847898938..70f8bf57e 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -3,7 +3,8 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "../mwworld/inventorystore.hpp" #include "../mwworld/manualref.hpp" #include "../mwsound/soundmanager.hpp" diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index ced2a5c3f..aedfcd2ea 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -3,9 +3,10 @@ #include -#include "../mwbase/environment.hpp" +#include -#include "../mwworld/world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" namespace MWMechanics { diff --git a/apps/openmw/mwmechanics/mechanicsmanager.cpp b/apps/openmw/mwmechanics/mechanicsmanager.cpp index 331074ef7..13052d064 100644 --- a/apps/openmw/mwmechanics/mechanicsmanager.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanager.cpp @@ -3,14 +3,14 @@ #include -#include "../mwgui/window_manager.hpp" - #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/class.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" +#include "../mwgui/window_manager.hpp" + namespace MWMechanics { void MechanicsManager::buildPlayer() diff --git a/apps/openmw/mwmechanics/spells.cpp b/apps/openmw/mwmechanics/spells.cpp index 70eb78639..5d21d96d0 100644 --- a/apps/openmw/mwmechanics/spells.cpp +++ b/apps/openmw/mwmechanics/spells.cpp @@ -1,11 +1,12 @@ #include "spells.hpp" +#include + #include #include "../mwbase/environment.hpp" - -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "magiceffects.hpp" diff --git a/apps/openmw/mwmechanics/spellsuccess.hpp b/apps/openmw/mwmechanics/spellsuccess.hpp index 11ac7cda7..54172a72a 100644 --- a/apps/openmw/mwmechanics/spellsuccess.hpp +++ b/apps/openmw/mwmechanics/spellsuccess.hpp @@ -1,9 +1,11 @@ #ifndef MWMECHANICS_SPELLSUCCESS_H #define MWMECHANICS_SPELLSUCCESS_H -#include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" + +#include "../mwworld/ptr.hpp" +#include "../mwworld/class.hpp" #include "../mwmechanics/creaturestats.hpp" #include "npcstats.hpp" diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index 206a051f0..a19d411a4 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -1,7 +1,7 @@ #include "creatureanimation.hpp" #include "renderconst.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" using namespace Ogre; using namespace NifOgre; diff --git a/apps/openmw/mwrender/debugging.cpp b/apps/openmw/mwrender/debugging.cpp index 9086a9bc4..5fe59f5e5 100644 --- a/apps/openmw/mwrender/debugging.cpp +++ b/apps/openmw/mwrender/debugging.cpp @@ -1,18 +1,22 @@ #include "debugging.hpp" -#include +#include #include #include #include #include -#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone -#include "../mwbase/environment.hpp" -#include "../mwworld/ptr.hpp" #include #include +#include + +#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" using namespace Ogre; @@ -162,11 +166,11 @@ Debugging::~Debugging() bool Debugging::toggleRenderMode (int mode){ switch (mode) { - case MWWorld::World::Render_CollisionDebug: + case MWBase::World::Render_CollisionDebug: return mEngine->toggleDebugRendering(); - case MWWorld::World::Render_Pathgrid: + case MWBase::World::Render_Pathgrid: togglePathgrid(); return mPathgridEnabled; } diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 2442700bb..9d38f14da 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -1,13 +1,15 @@ #include "localmap.hpp" -#include "renderingmanager.hpp" + +#include +#include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "../mwgui/window_manager.hpp" -#include "renderconst.hpp" -#include -#include +#include "renderconst.hpp" +#include "renderingmanager.hpp" using namespace MWRender; using namespace Ogre; diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 5681a3ad1..888b11e1e 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -1,8 +1,9 @@ #include "npcanimation.hpp" -#include "../mwworld/world.hpp" -#include "renderconst.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + +#include "renderconst.hpp" using namespace Ogre; using namespace NifOgre; diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 03bb24635..7ca5f8982 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -1,6 +1,6 @@ #include "renderingmanager.hpp" -#include +#include #include "OgreRoot.h" #include "OgreRenderWindow.h" @@ -9,22 +9,24 @@ #include "OgreCamera.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 #include +#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 "shaderhelper.hpp" #include "localmap.hpp" #include "water.hpp" #include "compositors.hpp" -#include "../mwgui/window_manager.hpp" // FIXME -#include "../mwinput/inputmanager.hpp" // FIXME - using namespace MWRender; using namespace Ogre; @@ -298,9 +300,9 @@ void RenderingManager::skySetMoonColour (bool red){ 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); - else if (mode == MWWorld::World::Render_Wireframe) + else if (mode == MWBase::World::Render_Wireframe) { if (mRendering.getCamera()->getPolygonMode() == PM_SOLID) { diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 19e45c189..cf4386793 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -11,7 +11,8 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" + #include "renderconst.hpp" #include "renderingmanager.hpp" diff --git a/apps/openmw/mwrender/terrain.cpp b/apps/openmw/mwrender/terrain.cpp index 4dac750c7..4678daa34 100644 --- a/apps/openmw/mwrender/terrain.cpp +++ b/apps/openmw/mwrender/terrain.cpp @@ -1,16 +1,18 @@ +#include + #include #include -#include -#include "../mwworld/world.hpp" +#include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "terrainmaterial.hpp" #include "terrain.hpp" #include "renderconst.hpp" #include "shadows.hpp" -#include +#include "renderingmanager.hpp" using namespace Ogre; diff --git a/apps/openmw/mwrender/terrain.hpp b/apps/openmw/mwrender/terrain.hpp index 273ede084..0693c0cec 100644 --- a/apps/openmw/mwrender/terrain.hpp +++ b/apps/openmw/mwrender/terrain.hpp @@ -16,6 +16,8 @@ namespace Ogre{ namespace MWRender{ + class RenderingManager; + /** * Implements the Morrowind terrain using the Ogre Terrain Component * diff --git a/apps/openmw/mwscript/aiextensions.cpp b/apps/openmw/mwscript/aiextensions.cpp index 08b1f6f8c..924a0e9dd 100644 --- a/apps/openmw/mwscript/aiextensions.cpp +++ b/apps/openmw/mwscript/aiextensions.cpp @@ -7,6 +7,8 @@ #include #include +#include "../mwworld/class.hpp" + #include "../mwmechanics/creaturestats.hpp" #include "interpretercontext.hpp" diff --git a/apps/openmw/mwscript/animationextensions.cpp b/apps/openmw/mwscript/animationextensions.cpp index 864a2bf1d..6f9253e5d 100644 --- a/apps/openmw/mwscript/animationextensions.cpp +++ b/apps/openmw/mwscript/animationextensions.cpp @@ -9,7 +9,7 @@ #include #include -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "interpretercontext.hpp" #include "ref.hpp" diff --git a/apps/openmw/mwscript/cellextensions.cpp b/apps/openmw/mwscript/cellextensions.cpp index a5db5fd5f..c1d09fac4 100644 --- a/apps/openmw/mwscript/cellextensions.cpp +++ b/apps/openmw/mwscript/cellextensions.cpp @@ -1,6 +1,8 @@ #include "cellextensions.hpp" +#include + #include #include @@ -8,8 +10,8 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" #include "interpretercontext.hpp" diff --git a/apps/openmw/mwscript/compilercontext.cpp b/apps/openmw/mwscript/compilercontext.cpp index 0a6ffd0c7..57e786b11 100644 --- a/apps/openmw/mwscript/compilercontext.cpp +++ b/apps/openmw/mwscript/compilercontext.cpp @@ -1,9 +1,13 @@ #include "compilercontext.hpp" +#include + #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/ptr.hpp" +#include "../mwworld/class.hpp" #include "scriptmanager.hpp" diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp index 1a7b45246..1f5bdcafb 100644 --- a/apps/openmw/mwscript/controlextensions.cpp +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -10,6 +10,7 @@ #include "../mwbase/environment.hpp" #include "../mwworld/player.hpp" +#include "../mwworld/class.hpp" #include "../mwmechanics/npcstats.hpp" diff --git a/apps/openmw/mwscript/globalscripts.cpp b/apps/openmw/mwscript/globalscripts.cpp index eb96ba5e2..3f4cec723 100644 --- a/apps/openmw/mwscript/globalscripts.cpp +++ b/apps/openmw/mwscript/globalscripts.cpp @@ -3,6 +3,9 @@ #include +#include +#include + #include "interpretercontext.hpp" #include "scriptmanager.hpp" diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 152fcf85c..5da512778 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -3,13 +3,13 @@ #include #include -#include #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" +#include "../mwworld/class.hpp" #include "../mwgui/window_manager.hpp" diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index 9fdc3c21a..6d97f7949 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -5,8 +5,9 @@ #include +#include "../mwbase/world.hpp" + #include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/action.hpp" namespace MWSound diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index c7569ccdd..0c328e0da 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -1,6 +1,8 @@ #include "miscextensions.hpp" +#include + #include #include @@ -102,7 +104,7 @@ namespace MWScript static_cast (runtime.getContext()); bool enabled = - MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_CollisionDebug); + MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_CollisionDebug); context.report (enabled ? "Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off"); @@ -119,7 +121,7 @@ namespace MWScript static_cast (runtime.getContext()); bool enabled = - MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Wireframe); + MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_Wireframe); context.report (enabled ? "Wireframe Rendering -> On" : "Wireframe Rendering -> Off"); @@ -135,7 +137,7 @@ namespace MWScript static_cast (runtime.getContext()); bool enabled = - MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Pathgrid); + MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_Pathgrid); context.report (enabled ? "Path Grid rendering -> On" : "Path Grid Rendering -> Off"); diff --git a/apps/openmw/mwscript/ref.hpp b/apps/openmw/mwscript/ref.hpp index 28093c4e5..81b1d5ef9 100644 --- a/apps/openmw/mwscript/ref.hpp +++ b/apps/openmw/mwscript/ref.hpp @@ -6,9 +6,9 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" #include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" #include "interpretercontext.hpp" diff --git a/apps/openmw/mwscript/soundextensions.cpp b/apps/openmw/mwscript/soundextensions.cpp index c2b45641a..3e05d72d3 100644 --- a/apps/openmw/mwscript/soundextensions.cpp +++ b/apps/openmw/mwscript/soundextensions.cpp @@ -8,8 +8,7 @@ #include #include "../mwbase/environment.hpp" - -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "../mwsound/soundmanager.hpp" diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index ff618ac33..29563ecc1 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -9,10 +9,12 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" -#include "../mwworld/world.hpp" #include "../mwworld/player.hpp" +#include "../mwrender/player.hpp" + #include "sound_output.hpp" #include "sound_decoder.hpp" #include "sound.hpp" diff --git a/apps/openmw/mwworld/actionequip.cpp b/apps/openmw/mwworld/actionequip.cpp index f3bb256fd..52b9437fd 100644 --- a/apps/openmw/mwworld/actionequip.cpp +++ b/apps/openmw/mwworld/actionequip.cpp @@ -1,9 +1,11 @@ #include "actionequip.hpp" #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" -#include "../mwworld/inventorystore.hpp" -#include "../mwworld/player.hpp" +#include "../mwbase/world.hpp" + +#include "inventorystore.hpp" +#include "player.hpp" +#include "class.hpp" namespace MWWorld { @@ -14,7 +16,7 @@ namespace MWWorld void ActionEquip::execute () { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); - MWWorld::InventoryStore& invStore = static_cast(MWWorld::Class::get(player).getContainerStore(player)); + MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player); // slots that this item can be equipped in std::pair, bool> slots = MWWorld::Class::get(mObject).getEquipmentSlots(mObject); @@ -51,4 +53,3 @@ namespace MWWorld } } } - diff --git a/apps/openmw/mwworld/actionopen.cpp b/apps/openmw/mwworld/actionopen.cpp index dd36487dc..a70773af9 100644 --- a/apps/openmw/mwworld/actionopen.cpp +++ b/apps/openmw/mwworld/actionopen.cpp @@ -1,13 +1,14 @@ #include "actionopen.hpp" #include "../mwbase/environment.hpp" -#include "class.hpp" -#include "world.hpp" -#include "containerstore.hpp" + #include "../mwclass/container.hpp" #include "../mwgui/window_manager.hpp" #include "../mwgui/container.hpp" +#include "class.hpp" +#include "containerstore.hpp" + namespace MWWorld { ActionOpen::ActionOpen (const MWWorld::Ptr& container) : mContainer (container) { diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index 9cff42812..39544b35d 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -2,10 +2,11 @@ #include "actiontake.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwgui/window_manager.hpp" #include "class.hpp" -#include "world.hpp" #include "containerstore.hpp" namespace MWWorld diff --git a/apps/openmw/mwworld/actionteleport.cpp b/apps/openmw/mwworld/actionteleport.cpp index 6ebbd7b7f..8ae3244f8 100644 --- a/apps/openmw/mwworld/actionteleport.cpp +++ b/apps/openmw/mwworld/actionteleport.cpp @@ -2,8 +2,7 @@ #include "actionteleport.hpp" #include "../mwbase/environment.hpp" - -#include "world.hpp" +#include "../mwbase/world.hpp" namespace MWWorld { diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 64290d9b7..e2c652ef4 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -4,7 +4,9 @@ #include -#include "world.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "class.hpp" #include "containerstore.hpp" @@ -85,8 +87,8 @@ MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellS return ptr; } -MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader, MWWorld::World& world) -: mStore (store), mReader (reader), mWorld (world), +MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader) +: mStore (store), mReader (reader), mIdCache (20, std::pair ("", 0)), /// \todo make cache size configurable mIdCacheIndex (0) {} @@ -111,11 +113,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y) record.water = 0; record.mapColor = 0; - cell = mWorld.createRecord (record); + cell = MWBase::Environment::get().getWorld()->createRecord (record); } 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) diff --git a/apps/openmw/mwworld/cells.hpp b/apps/openmw/mwworld/cells.hpp index 05367138f..3e1383166 100644 --- a/apps/openmw/mwworld/cells.hpp +++ b/apps/openmw/mwworld/cells.hpp @@ -18,39 +18,36 @@ namespace ESM namespace MWWorld { - class World; - /// \brief Cell container class Cells { const ESMS::ESMStore& mStore; ESM::ESMReader& mReader; - std::map mInteriors; - std::map, Ptr::CellStore> mExteriors; - MWWorld::World& mWorld; - std::vector > mIdCache; + std::map mInteriors; + std::map, CellStore> mExteriors; + std::vector > mIdCache; std::size_t mIdCacheIndex; Cells (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: - 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 /// 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); }; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 8ce1b5c8f..1d473246c 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -10,7 +10,7 @@ #include #include "../mwbase/environment.hpp" -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "manualref.hpp" #include "refdata.hpp" diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 6df73004b..b1f7a2e0d 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -7,8 +7,7 @@ #include #include "../mwbase/environment.hpp" - -#include "../mwworld/world.hpp" +#include "../mwbase/world.hpp" #include "../mwmechanics/npcstats.hpp" diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 7c1ff31b4..4d16a6d1c 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -1,18 +1,19 @@ +#include "physicssystem.hpp" + #include -#include "physicssystem.hpp" -#include "../mwworld/ptr.hpp" -#include "../mwworld/world.hpp" // FIXME -#include +#include +#include +#include +#include +#include +#include -#include "OgreRoot.h" -#include "OgreRenderWindow.h" -#include "OgreSceneManager.h" -#include "OgreViewport.h" -#include "OgreCamera.h" -#include "OgreTextureManager.h" +#include +#include "../mwbase/world.hpp" // FIXME +#include "ptr.hpp" using namespace Ogre; namespace MWWorld diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 91b030d1c..3edcba0c8 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -1,18 +1,20 @@ #include "player.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "../mwrender/player.hpp" #include "../mwmechanics/movement.hpp" #include "../mwmechanics/npcstats.hpp" -#include "world.hpp" #include "class.hpp" namespace MWWorld { - Player::Player (MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world) : - mCellStore (0), mRenderer (renderer), mWorld (world), mClass (0), + Player::Player (MWRender::Player *renderer, const ESM::NPC *player, const MWBase::World& world) : + mCellStore (0), mRenderer (renderer), mClass (0), mAutoMove (false), mForwardBackward (0) { mPlayer.base = player; @@ -36,8 +38,8 @@ namespace MWWorld void Player::setPos(float x, float y, float z) { - /// \todo This fcuntion should be removed during the mwrender-refactoring. - mWorld.moveObject (getPlayer(), x, y, z); + /// \todo This fcuntion should be removed during the mwrender-refactoring. + MWBase::Environment::get().getWorld()->moveObject (getPlayer(), x, y, z); } void Player::setRot(float x, float y, float z) @@ -90,14 +92,13 @@ namespace MWWorld 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; - } + } void Player::toggleRunning() { diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index c8f60a2ee..7521342cf 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -9,6 +9,11 @@ #include "../mwmechanics/drawstate.hpp" +namespace MWBase +{ + class World; +} + namespace MWRender { class Player; @@ -16,15 +21,12 @@ namespace MWRender namespace MWWorld { - class World; - /// \brief NPC object representing the player and additional player data class Player { LiveCellRef mPlayer; MWWorld::Ptr::CellStore *mCellStore; MWRender::Player *mRenderer; - MWWorld::World& mWorld; std::string mName; bool mMale; std::string mRace; @@ -34,7 +36,7 @@ namespace MWWorld int mForwardBackward; 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(); diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index bbcbbf2af..0ccb5218e 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -1,7 +1,7 @@ #include "scene.hpp" -#include "world.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" /// FIXME #include "../mwmechanics/mechanicsmanager.hpp" @@ -9,12 +9,12 @@ #include "../mwgui/window_manager.hpp" -#include "../mwworld/world.hpp" /// FIXME #include "../mwworld/manualref.hpp" /// FIXME #include "ptr.hpp" #include "player.hpp" #include "class.hpp" +#include "localscripts.hpp" #include "cellfunctors.hpp" @@ -86,7 +86,7 @@ namespace MWWorld 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) mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY ); } @@ -95,7 +95,7 @@ namespace MWWorld mRendering.removeCell(*iter); //mPhysics->removeObject("Unnamed_43"); - mWorld->getLocalScripts().clearCell (*iter); + MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter); MWBase::Environment::get().getMechanicsManager()->dropActors (*iter); MWBase::Environment::get().getSoundManager()->stopSound (*iter); mActiveCells.erase(*iter); @@ -107,7 +107,7 @@ namespace MWWorld void Scene::loadCell (Ptr::CellStore *cell) { // 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)) { - 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) mPhysics->addHeightField (land->landData->heights, cell->cell->data.gridX, cell->cell->data.gridY, @@ -146,14 +146,14 @@ namespace MWWorld mPhysics->setCurrentWater(hasWater, cell->cell->water); if (adjustPlayerPos) { - mWorld->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().setPos (position.pos[0], position.pos[1], position.pos[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()->watchActor (mWorld->getPlayer().getPlayer()); + MWBase::Environment::get().getMechanicsManager()->addActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); + MWBase::Environment::get().getMechanicsManager()->watchActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); MWBase::Environment::get().getWindowManager()->changeCell( mCurrentCell ); } @@ -163,7 +163,7 @@ namespace MWWorld mRendering.preCellChange(mCurrentCell); // 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(); @@ -202,7 +202,7 @@ namespace MWWorld if (iter==mActiveCells.end()) { - Ptr::CellStore *cell = mWorld->getExterior(x, y); + CellStore *cell = MWBase::Environment::get().getWorld()->getExterior(x, y); loadCell (cell); } @@ -228,10 +228,10 @@ namespace MWWorld // adjust player - playerCellChange (mWorld->getExterior(X, Y), position, adjustPlayerPos); + playerCellChange (MWBase::Environment::get().getWorld()->getExterior(X, Y), position, adjustPlayerPos); // Sky system - mWorld->adjustSky(); + MWBase::Environment::get().getWorld()->adjustSky(); mRendering.switchToExterior(); @@ -239,9 +239,8 @@ namespace MWWorld } //We need the ogre renderer and a scene node. - Scene::Scene (World *world, MWRender::RenderingManager& rendering, PhysicsSystem *physics) - : mCurrentCell (0), mCellChanged (false), mWorld(world), - mPhysics(physics), mRendering(rendering) + Scene::Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics) + : mCurrentCell (0), mCellChanged (false), mPhysics(physics), mRendering(rendering) { } @@ -263,7 +262,7 @@ namespace MWWorld { std::cout << "Changing to interior\n"; - Ptr::CellStore *cell = mWorld->getInterior(cellName); + CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName); // remove active CellStoreCollection::iterator active = mActiveCells.begin(); @@ -287,7 +286,7 @@ namespace MWWorld mRendering.configureFog(*cell); // Sky system - mWorld->adjustSky(); + MWBase::Environment::get().getWorld()->adjustSky(); mCellChanged = true; } @@ -297,7 +296,7 @@ namespace MWWorld int x = 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); } diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 373b20ed5..52449a24d 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -59,7 +59,6 @@ namespace MWWorld Ptr::CellStore* mCurrentCell; // the cell, the player is in CellStoreCollection mActiveCells; bool mCellChanged; - World *mWorld; PhysicsSystem *mPhysics; MWRender::RenderingManager& mRendering; @@ -69,7 +68,7 @@ namespace MWWorld public: - Scene (World *world, MWRender::RenderingManager& rendering, PhysicsSystem *physics); + Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics); ~Scene(); diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 3d6547d6a..21f991050 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -1,9 +1,4 @@ #include "weather.hpp" -#include "world.hpp" -#include "player.hpp" - -#include "../mwrender/renderingmanager.hpp" -#include "../mwsound/soundmanager.hpp" #include #include @@ -12,6 +7,13 @@ #include #include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + +#include "../mwrender/renderingmanager.hpp" + +#include "../mwsound/soundmanager.hpp" + +#include "player.hpp" using namespace Ogre; using namespace MWWorld; diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/worldimp.cpp similarity index 99% rename from apps/openmw/mwworld/world.cpp rename to apps/openmw/mwworld/worldimp.cpp index b0067eabf..6f9f9936c 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1,4 +1,4 @@ -#include "world.hpp" +#include "worldimp.hpp" #include #include @@ -179,7 +179,7 @@ namespace MWWorld const std::string& master, const boost::filesystem::path& resDir, bool newGame, const std::string& encoding, std::map fallbackMap) : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), - mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm, *this), + mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm), mNumFacing(0) { mPhysics = new PhysicsSystem(renderer); @@ -211,7 +211,7 @@ namespace MWWorld mGlobalVariables->setInt ("chargenstate", 1); } - mWorldScene = new Scene(this, *mRendering, mPhysics); + mWorldScene = new Scene(*mRendering, mPhysics); setFallbackValues(fallbackMap); diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/worldimp.hpp similarity index 99% rename from apps/openmw/mwworld/world.hpp rename to apps/openmw/mwworld/worldimp.hpp index 526a2d7a6..b38bc6e2a 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -1,5 +1,5 @@ -#ifndef GAME_MWWORLD_WORLD_H -#define GAME_MWWORLD_WORLD_H +#ifndef GAME_MWWORLD_WORLDIMP_H +#define GAME_MWWORLD_WORLDIMP_H #include #include diff --git a/libs/openengine/bullet/CMotionState.cpp b/libs/openengine/bullet/CMotionState.cpp index d7746cbc5..dc28d9e5f 100644 --- a/libs/openengine/bullet/CMotionState.cpp +++ b/libs/openengine/bullet/CMotionState.cpp @@ -4,7 +4,6 @@ #include #include #include -//#include namespace OEngine { namespace Physic diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 1bc4341a0..500e8a7ef 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -3,7 +3,6 @@ #include #include #include -//#include #include "CMotionState.h" #include "OgreRoot.h" #include "btKinematicCharacterController.h" @@ -286,7 +285,7 @@ namespace Physic minh = h; maxh = h; } - + if (h>maxh) maxh = h; if (h #include #include -//#include #include #include - + enum traceWorldType { collisionWorldTrace = 1, @@ -33,7 +32,7 @@ struct NewPhysTraceResults float fraction; bool startSolid; //const Object* hitObj; -}; +}; struct traceResults { Ogre::Vector3 endpos;