second part of refactoring

pull/7/head
Marc Zinnschlag 15 years ago
parent f8cb4c2502
commit d51e6fb7c4

@ -10,12 +10,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
set(GAME set(GAME
apps/openmw/main.cpp apps/openmw/main.cpp
apps/openmw/engine.cpp apps/openmw/engine.cpp)
apps/openmw/world.cpp)
set(GAME_HEADER set(GAME_HEADER
apps/openmw/engine.hpp apps/openmw/engine.hpp)
apps/openmw/world.hpp
apps/openmw/refdata.hpp)
source_group(game FILES ${GAME} ${GAME_HEADER}) source_group(game FILES ${GAME} ${GAME_HEADER})
set(GAMEREND set(GAMEREND
@ -60,9 +57,17 @@ set(GAMESOUND_HEADER
apps/openmw/mwsound/extensions.hpp) apps/openmw/mwsound/extensions.hpp)
source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER}) source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER})
set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND}) set(GAMEWORLD
apps/openmw/mwworld/world.cpp)
set(GAMEWORLD_HEADER
apps/openmw/mwworld/refdata.hpp
apps/openmw/mwworld/world.hpp)
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
set(APPS ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND} ${GAMEWORLD})
set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER} set(APPS_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER}
${GAMESOUND_HEADER}) ${GAMESOUND_HEADER} ${GAMEWORLD_HEADER})
# source directory: components # source directory: components

@ -4,10 +4,11 @@
#include <iostream> #include <iostream>
#include "components/misc/fileops.hpp" #include <components/misc/fileops.hpp>
#include "components/bsa/bsa_archive.hpp" #include <components/bsa/bsa_archive.hpp>
#include "mwinput/inputmanager.hpp" #include "mwinput/inputmanager.hpp"
#include "mwscript/scriptmanager.hpp" #include "mwscript/scriptmanager.hpp"
#include "mwscript/compilercontextscript.hpp" #include "mwscript/compilercontextscript.hpp"
#include "mwscript/interpretercontext.hpp" #include "mwscript/interpretercontext.hpp"
@ -15,11 +16,11 @@
#include "mwsound/soundmanager.hpp" #include "mwsound/soundmanager.hpp"
#include "world.hpp" #include "mwworld/world.hpp"
void OMW::Engine::executeLocalScripts() void OMW::Engine::executeLocalScripts()
{ {
for (World::ScriptList::const_iterator iter (mWorld->getLocalScripts().begin()); for (MWWorld::World::ScriptList::const_iterator iter (mWorld->getLocalScripts().begin());
iter!=mWorld->getLocalScripts().end(); ++iter) iter!=mWorld->getLocalScripts().end(); ++iter)
{ {
MWScript::InterpreterContext interpreterContext (*mWorld, *mSoundManager, iter->second); MWScript::InterpreterContext interpreterContext (*mWorld, *mSoundManager, iter->second);
@ -163,7 +164,7 @@ void OMW::Engine::go()
loadBSA(); loadBSA();
// Create the world // Create the world
mWorld = new World (mOgre, mDataDir, mMaster, mCellName); mWorld = new MWWorld::World (mOgre, mDataDir, mMaster, mCellName);
mSoundManager = new MWSound::SoundManager; mSoundManager = new MWSound::SoundManager;

@ -7,10 +7,10 @@
#include <OgreFrameListener.h> #include <OgreFrameListener.h>
#include "components/engine/ogre/renderer.hpp" #include <components/engine/ogre/renderer.hpp>
#include "components/misc/tsdeque.hpp" #include <components/misc/tsdeque.hpp>
#include "components/commandserver/server.hpp" #include <components/commandserver/server.hpp>
#include "components/commandserver/command.hpp" #include <components/commandserver/command.hpp>
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>
namespace Compiler namespace Compiler
@ -28,10 +28,13 @@ namespace MWSound
class SoundManager; class SoundManager;
} }
namespace OMW namespace MWWorld
{ {
class World; class World;
}
namespace OMW
{
/// \brief Main engine class, that brings together all the components of OpenMW /// \brief Main engine class, that brings together all the components of OpenMW
class Engine : private Ogre::FrameListener class Engine : private Ogre::FrameListener
@ -42,7 +45,7 @@ namespace OMW
Render::OgreRenderer mOgre; Render::OgreRenderer mOgre;
std::string mCellName; std::string mCellName;
std::string mMaster; std::string mMaster;
World *mWorld; MWWorld::World *mWorld;
bool mDebug; bool mDebug;
bool mVerboseScripts; bool mVerboseScripts;

@ -18,7 +18,7 @@ void insertObj(CellRenderImp& cellRender, T& liveRef)
} }
template<> template<>
void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::Light, OMW::RefData>& liveRef) void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::Light, MWWorld::RefData>& liveRef)
{ {
assert (liveRef.base != NULL); assert (liveRef.base != NULL);
const std::string &model = liveRef.base->model; const std::string &model = liveRef.base->model;
@ -50,7 +50,7 @@ void insertCellRefList (CellRenderImp& cellRender, T& cellRefList)
} }
} }
void CellRenderImp::insertCell(ESMS::CellStore<OMW::RefData> &cell) void CellRenderImp::insertCell(ESMS::CellStore<MWWorld::RefData> &cell)
{ {
// Loop through all references in the cell // Loop through all references in the cell
insertCellRefList (*this, cell.activators); insertCellRefList (*this, cell.activators);

@ -5,7 +5,7 @@
#include "components/esm_store/cell_store.hpp" #include "components/esm_store/cell_store.hpp"
#include "../refdata.hpp" #include "../mwworld/refdata.hpp"
namespace ESM namespace ESM
{ {
@ -35,7 +35,7 @@ namespace MWRender
/// finish inserting a new reference and return a handle to it. /// finish inserting a new reference and return a handle to it.
virtual std::string insertEnd() = 0; virtual std::string insertEnd() = 0;
void insertCell(ESMS::CellStore<OMW::RefData> &cell); void insertCell(ESMS::CellStore<MWWorld::RefData> &cell);
}; };
} }

@ -42,7 +42,7 @@ namespace MWRender
static bool lightOutQuadInLin; static bool lightOutQuadInLin;
ESMS::CellStore<OMW::RefData> &cell; ESMS::CellStore<MWWorld::RefData> &cell;
MWScene &scene; MWScene &scene;
/// The scene node that contains all objects belonging to this /// The scene node that contains all objects belonging to this
@ -78,7 +78,7 @@ namespace MWRender
public: public:
InteriorCellRender(ESMS::CellStore<OMW::RefData> &_cell, MWScene &_scene) InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWScene &_scene)
: cell(_cell), scene(_scene), base(NULL), insert(NULL), ambientMode (0) {} : cell(_cell), scene(_scene), base(NULL), insert(NULL), ambientMode (0) {}
virtual ~InteriorCellRender() { destroy(); } virtual ~InteriorCellRender() { destroy(); }

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

@ -5,11 +5,11 @@
#include <iostream> #include <iostream>
#include "locals.hpp" #include "locals.hpp"
#include "../world.hpp" #include "../mwworld/world.hpp"
namespace MWScript namespace MWScript
{ {
InterpreterContext::InterpreterContext (OMW::World& world, InterpreterContext::InterpreterContext (MWWorld::World& world,
MWSound::SoundManager& soundManager, MWScript::Locals *locals) MWSound::SoundManager& soundManager, MWScript::Locals *locals)
: mWorld (world), mSoundManager (soundManager), mLocals (locals) : mWorld (world), mSoundManager (soundManager), mLocals (locals)
{} {}
@ -71,7 +71,7 @@ namespace MWScript
std::cerr << "error: message box buttons not supported" << std::endl; std::cerr << "error: message box buttons not supported" << std::endl;
} }
OMW::World& InterpreterContext::getWorld() MWWorld::World& InterpreterContext::getWorld()
{ {
return mWorld; return mWorld;
} }

@ -3,7 +3,7 @@
#include <components/interpreter/context.hpp> #include <components/interpreter/context.hpp>
namespace OMW namespace MWWorld
{ {
class World; class World;
} }
@ -19,13 +19,13 @@ namespace MWScript
class InterpreterContext : public Interpreter::Context class InterpreterContext : public Interpreter::Context
{ {
OMW::World& mWorld; MWWorld::World& mWorld;
MWSound::SoundManager& mSoundManager; MWSound::SoundManager& mSoundManager;
Locals *mLocals; Locals *mLocals;
public: public:
InterpreterContext (OMW::World& world, MWSound::SoundManager& soundManager, InterpreterContext (MWWorld::World& world, MWSound::SoundManager& soundManager,
MWScript::Locals *locals); MWScript::Locals *locals);
///< The ownership of \a locals is not transferred. 0-pointer allowed. ///< The ownership of \a locals is not transferred. 0-pointer allowed.
@ -44,7 +44,7 @@ namespace MWScript
virtual void messageBox (const std::string& message, virtual void messageBox (const std::string& message,
const std::vector<std::string>& buttons); const std::vector<std::string>& buttons);
OMW::World& getWorld(); MWWorld::World& getWorld();
MWSound::SoundManager& getSoundManager(); MWSound::SoundManager& getSoundManager();
}; };

@ -9,7 +9,7 @@
#include "../mwscript/interpretercontext.hpp" #include "../mwscript/interpretercontext.hpp"
#include "../world.hpp" #include "../mwworld/world.hpp"
#include "soundmanager.hpp" #include "soundmanager.hpp"

@ -1,16 +1,16 @@
#ifndef REFDATA_H #ifndef GAME_MWWORLD_REFDATA_H
#define REFDATA_H #define GAME_MWWORLD_REFDATA_H
#include <string> #include <string>
#include "mwscript/locals.hpp" #include "../mwscript/locals.hpp"
namespace ESM namespace ESM
{ {
class Script; class Script;
} }
namespace OMW namespace MWWorld
{ {
class RefData class RefData
{ {

@ -13,9 +13,9 @@ namespace
{ {
template<typename T> template<typename T>
void listCellScripts (const ESMS::ESMStore& store, void listCellScripts (const ESMS::ESMStore& store,
ESMS::CellRefList<T, OMW::RefData>& cellRefList, OMW::World::ScriptList& scriptList) ESMS::CellRefList<T, MWWorld::RefData>& cellRefList, MWWorld::World::ScriptList& scriptList)
{ {
for (typename ESMS::CellRefList<T, OMW::RefData>::List::iterator iter ( for (typename ESMS::CellRefList<T, MWWorld::RefData>::List::iterator iter (
cellRefList.list.begin()); cellRefList.list.begin());
iter!=cellRefList.list.end(); ++iter) iter!=cellRefList.list.end(); ++iter)
{ {
@ -33,9 +33,9 @@ namespace
} }
} }
namespace OMW namespace MWWorld
{ {
void World::insertInteriorScripts (ESMS::CellStore<OMW::RefData>& cell) void World::insertInteriorScripts (ESMS::CellStore<RefData>& cell)
{ {
listCellScripts (mStore, cell.activators, mLocalScripts); listCellScripts (mStore, cell.activators, mLocalScripts);
listCellScripts (mStore, cell.potions, mLocalScripts); listCellScripts (mStore, cell.potions, mLocalScripts);

@ -1,16 +1,15 @@
#ifndef WORLD_H #ifndef GAME_MWWORLD_WORLD_H
#define WORLD_H #define GAME_MWWORLD_WORLD_H
#include <vector> #include <vector>
#include <map> #include <map>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include "components/esm_store/cell_store.hpp" #include <components/esm_store/cell_store.hpp>
#include "apps/openmw/mwrender/playerpos.hpp"
#include "apps/openmw/mwrender/mwscene.hpp"
#include "../mwrender/playerpos.hpp"
#include "../mwrender/mwscene.hpp"
#include "refdata.hpp" #include "refdata.hpp"
@ -25,7 +24,7 @@ namespace MWRender
class CellRender; class CellRender;
} }
namespace OMW namespace MWWorld
{ {
/// \brief The game world and its visual representation /// \brief The game world and its visual representation
@ -54,7 +53,7 @@ namespace OMW
World (const World&); World (const World&);
World& operator= (const World&); World& operator= (const World&);
void insertInteriorScripts (ESMS::CellStore<OMW::RefData>& cell); void insertInteriorScripts (ESMS::CellStore<RefData>& cell);
public: public:
Loading…
Cancel
Save