Issue #107: Ptr related include cleanup

This commit is contained in:
Marc Zinnschlag 2012-07-03 13:55:53 +02:00
parent 5a7b95bf7a
commit 87667ab57e
18 changed files with 111 additions and 66 deletions

View file

@ -22,7 +22,7 @@ namespace MWGui
MWWorld::Ptr mPtr; MWWorld::Ptr mPtr;
private: private:
MWWorld::Ptr::CellStore* mCurrentPlayerCell; MWWorld::CellStore* mCurrentPlayerCell;
}; };
} }

View file

@ -26,14 +26,16 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/cellstore.hpp"
#include "console.hpp" #include "console.hpp"
#include "journalwindow.hpp" #include "journalwindow.hpp"
#include "charactercreation.hpp" #include "charactercreation.hpp"
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <assert.h> #include <cassert>
#include <iostream>
#include <iterator> #include <iterator>
using namespace MWGui; using namespace MWGui;

View file

@ -22,7 +22,6 @@
#include <openengine/gui/manager.hpp> #include <openengine/gui/manager.hpp>
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include "../mwworld/ptr.hpp"
#include "mode.hpp" #include "mode.hpp"
@ -39,7 +38,8 @@ namespace Compiler
namespace MWWorld namespace MWWorld
{ {
class World; class Ptr;
class CellStore;
} }
namespace MWMechanics namespace MWMechanics
@ -181,7 +181,7 @@ namespace MWGui
void setBounty (int bounty); ///< set the current bounty value void setBounty (int bounty); ///< set the current bounty value
void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
void changeCell(MWWorld::Ptr::CellStore* cell); ///< change the active cell void changeCell(MWWorld::CellStore* cell); ///< change the active cell
void setPlayerPos(const float x, const float y); ///< set player position in map space void setPlayerPos(const float x, const float y); ///< set player position in map space
void setPlayerDir(const float x, const float y); ///< set player view direction in map space void setPlayerDir(const float x, const float y); ///< set player view direction in map space

View file

@ -5,13 +5,17 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "../mwworld/ptr.hpp"
namespace Ogre namespace Ogre
{ {
class Vector3; class Vector3;
} }
namespace MWWorld
{
class Ptr;
class CellStore;
}
namespace MWMechanics namespace MWMechanics
{ {
class Actors class Actors
@ -35,7 +39,7 @@ namespace MWMechanics
/// ///
/// \note Ignored, if \a ptr is not a registered actor. /// \note Ignored, if \a ptr is not a registered actor.
void dropActors (const MWWorld::Ptr::CellStore *cellStore); void dropActors (const MWWorld::CellStore *cellStore);
///< Deregister all actors in the given cell. ///< Deregister all actors in the given cell.
void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement, void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,

View file

@ -15,6 +15,11 @@ namespace Ogre
class Vector3; class Vector3;
} }
namespace MWWorld
{
class CellStore;
}
namespace MWMechanics namespace MWMechanics
{ {
class MechanicsManager class MechanicsManager
@ -43,7 +48,7 @@ namespace MWMechanics
void removeActor (const MWWorld::Ptr& ptr); void removeActor (const MWWorld::Ptr& ptr);
///< Deregister an actor for stats management ///< Deregister an actor for stats management
void dropActors (const MWWorld::Ptr::CellStore *cellStore); void dropActors (const MWWorld::CellStore *cellStore);
///< Deregister all actors in the given cell. ///< Deregister all actors in the given cell.
void watchActor (const MWWorld::Ptr& ptr); void watchActor (const MWWorld::Ptr& ptr);

View file

@ -8,16 +8,22 @@
#include "components/nifogre/ogre_nif_loader.hpp" #include "components/nifogre/ogre_nif_loader.hpp"
#include "../mwworld/refdata.hpp" #include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontalk.hpp" #include "../mwworld/actiontalk.hpp"
#include "npcanimation.hpp" #include "npcanimation.hpp"
#include "creatureanimation.hpp" #include "creatureanimation.hpp"
#include <openengine/bullet/physic.hpp> #include <openengine/bullet/physic.hpp>
namespace MWWorld
{
class Ptr;
class CellStore;
}
namespace MWRender{ namespace MWRender{
class Actors{ class Actors{
OEngine::Render::OgreRenderer &mRend; OEngine::Render::OgreRenderer &mRend;
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes; std::map<MWWorld::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
Ogre::SceneNode* mMwRoot; Ogre::SceneNode* mMwRoot;
std::map<MWWorld::Ptr, Animation*> mAllActors; std::map<MWWorld::Ptr, Animation*> mAllActors;
@ -33,7 +39,7 @@ namespace MWRender{
bool deleteObject (const MWWorld::Ptr& ptr); bool deleteObject (const MWWorld::Ptr& ptr);
///< \return found? ///< \return found?
void removeCell(MWWorld::Ptr::CellStore* store); void removeCell(MWWorld::CellStore* store);
void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode, void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
int number = 1); int number = 1);

View file

@ -4,11 +4,15 @@
#include <utility> #include <utility>
#include <openengine/ogre/renderer.hpp> #include <openengine/ogre/renderer.hpp>
#include <openengine/bullet/physic.hpp> #include <openengine/bullet/physic.hpp>
#include "../mwworld/ptr.hpp"
#include <vector> #include <vector>
#include <string> #include <string>
namespace ESM
{
struct Pathgrid;
}
namespace Ogre namespace Ogre
{ {
class Camera; class Camera;
@ -22,7 +26,8 @@ namespace Ogre
namespace MWWorld namespace MWWorld
{ {
class World; class Ptr;
class CellStore;
} }
namespace MWRender namespace MWRender
@ -39,7 +44,7 @@ namespace MWRender
void togglePathgrid(); void togglePathgrid();
typedef std::vector<MWWorld::Ptr::CellStore *> CellList; typedef std::vector<MWWorld::CellStore *> CellList;
CellList mActiveCells; CellList mActiveCells;
Ogre::SceneNode *mMwRoot; Ogre::SceneNode *mMwRoot;
@ -50,8 +55,8 @@ namespace MWRender
ExteriorPathgridNodes mExteriorPathgridNodes; ExteriorPathgridNodes mExteriorPathgridNodes;
Ogre::SceneNode *mInteriorPathgridNode; Ogre::SceneNode *mInteriorPathgridNode;
void enableCellPathgrid(MWWorld::Ptr::CellStore *store); void enableCellPathgrid(MWWorld::CellStore *store);
void disableCellPathgrid(MWWorld::Ptr::CellStore *store); void disableCellPathgrid(MWWorld::CellStore *store);
// utility // utility
void destroyCellPathgridNode(Ogre::SceneNode *node); void destroyCellPathgridNode(Ogre::SceneNode *node);
@ -70,8 +75,8 @@ namespace MWRender
~Debugging(); ~Debugging();
bool toggleRenderMode (int mode); bool toggleRenderMode (int mode);
void cellAdded(MWWorld::Ptr::CellStore* store); void cellAdded(MWWorld::CellStore* store);
void cellRemoved(MWWorld::Ptr::CellStore* store); void cellRemoved(MWWorld::CellStore* store);
}; };

View file

@ -1,10 +1,15 @@
#ifndef _GAME_RENDER_LOCALMAP_H #ifndef _GAME_RENDER_LOCALMAP_H
#define _GAME_RENDER_LOCALMAP_H #define _GAME_RENDER_LOCALMAP_H
#include "../mwworld/ptr.hpp"
#include <openengine/ogre/renderer.hpp> #include <openengine/ogre/renderer.hpp>
#include <OgreAxisAlignedBox.h>
namespace MWWorld
{
class CellStore;
}
namespace MWRender namespace MWRender
{ {
class RenderingManager; class RenderingManager;
@ -24,7 +29,7 @@ namespace MWRender
* or rendered if it is not already cached. * or rendered if it is not already cached.
* @param exterior cell * @param exterior cell
*/ */
void requestMap (MWWorld::Ptr::CellStore* cell); void requestMap (MWWorld::CellStore* cell);
/** /**
* Request the local map for an interior cell. * Request the local map for an interior cell.
@ -33,7 +38,7 @@ namespace MWRender
* @param interior cell * @param interior cell
* @param bounding box of the cell * @param bounding box of the cell
*/ */
void requestMap (MWWorld::Ptr::CellStore* cell, void requestMap (MWWorld::CellStore* cell,
Ogre::AxisAlignedBox bounds); Ogre::AxisAlignedBox bounds);
/** /**
@ -51,7 +56,7 @@ namespace MWRender
* new cell, as well as when the game is quit. * new cell, as well as when the game is quit.
* @param current cell * @param current cell
*/ */
void saveFogOfWar(MWWorld::Ptr::CellStore* cell); void saveFogOfWar(MWWorld::CellStore* cell);
private: private:
OEngine::Render::OgreRenderer* mRendering; OEngine::Render::OgreRenderer* mRendering;

View file

@ -4,6 +4,9 @@
#include <components/nifogre/ogre_nif_loader.hpp> #include <components/nifogre/ogre_nif_loader.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "../mwworld/ptr.hpp"
#include "renderconst.hpp" #include "renderconst.hpp"
using namespace MWRender; using namespace MWRender;

View file

@ -1,10 +1,15 @@
#ifndef _GAME_RENDER_OBJECTS_H #ifndef _GAME_RENDER_OBJECTS_H
#define _GAME_RENDER_OBJECTS_H #define _GAME_RENDER_OBJECTS_H
#include <OgreColourValue.h>
#include <openengine/ogre/renderer.hpp> #include <openengine/ogre/renderer.hpp>
#include "../mwworld/refdata.hpp" namespace MWWorld
#include "../mwworld/ptr.hpp" {
class Ptr;
class CellStore;
}
namespace MWRender{ namespace MWRender{
@ -45,10 +50,10 @@ struct LightInfo
class Objects{ class Objects{
OEngine::Render::OgreRenderer &mRenderer; OEngine::Render::OgreRenderer &mRenderer;
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes; std::map<MWWorld::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometry; std::map<MWWorld::CellStore *, Ogre::StaticGeometry*> mStaticGeometry;
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometrySmall; std::map<MWWorld::CellStore *, Ogre::StaticGeometry*> mStaticGeometrySmall;
std::map<MWWorld::Ptr::CellStore *, Ogre::AxisAlignedBox> mBounds; std::map<MWWorld::CellStore *, Ogre::AxisAlignedBox> mBounds;
std::vector<LightInfo> mLights; std::vector<LightInfo> mLights;
Ogre::SceneNode* mMwRoot; Ogre::SceneNode* mMwRoot;
bool mIsStatic; bool mIsStatic;
@ -79,14 +84,14 @@ public:
void update (const float dt); void update (const float dt);
///< per-frame update ///< per-frame update
Ogre::AxisAlignedBox getDimensions(MWWorld::Ptr::CellStore*); Ogre::AxisAlignedBox getDimensions(MWWorld::CellStore*);
///< get a bounding box that encloses all objects in the specified cell ///< get a bounding box that encloses all objects in the specified cell
bool deleteObject (const MWWorld::Ptr& ptr); bool deleteObject (const MWWorld::Ptr& ptr);
///< \return found? ///< \return found?
void removeCell(MWWorld::Ptr::CellStore* store); void removeCell(MWWorld::CellStore* store);
void buildStaticGeometry(MWWorld::Ptr::CellStore &cell); void buildStaticGeometry(MWWorld::CellStore &cell);
void setMwRoot(Ogre::SceneNode* root); void setMwRoot(Ogre::SceneNode* root);
}; };
} }

View file

@ -20,8 +20,6 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "../mwworld/ptr.hpp"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include "renderinginterface.hpp" #include "renderinginterface.hpp"
@ -41,7 +39,8 @@ namespace Ogre
namespace MWWorld namespace MWWorld
{ {
class World; class Ptr;
class CellStore;
} }
namespace MWRender namespace MWRender
@ -79,18 +78,18 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
OEngine::Render::Fader* getFader(); OEngine::Render::Fader* getFader();
void removeCell (MWWorld::Ptr::CellStore *store); void removeCell (MWWorld::CellStore *store);
/// \todo this function should be removed later. Instead the rendering subsystems should track /// \todo this function should be removed later. Instead the rendering subsystems should track
/// when rebatching is needed and update automatically at the end of each frame. /// when rebatching is needed and update automatically at the end of each frame.
void cellAdded (MWWorld::Ptr::CellStore *store); void cellAdded (MWWorld::CellStore *store);
void waterAdded(MWWorld::Ptr::CellStore *store); void waterAdded(MWWorld::CellStore *store);
void removeWater(); void removeWater();
static const bool useMRT(); static const bool useMRT();
void preCellChange (MWWorld::Ptr::CellStore* store); void preCellChange (MWWorld::CellStore* store);
///< this event is fired immediately before changing cell ///< this event is fired immediately before changing cell
void addObject (const MWWorld::Ptr& ptr); void addObject (const MWWorld::Ptr& ptr);
@ -105,7 +104,7 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
void toggleWater(); void toggleWater();
/// \param store Cell the object was in previously (\a ptr has already been updated to the new cell). /// \param store Cell the object was in previously (\a ptr has already been updated to the new cell).
void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store); void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::CellStore *store);
void update (float duration); void update (float duration);
@ -136,13 +135,13 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
int skyGetMasserPhase() const; int skyGetMasserPhase() const;
int skyGetSecundaPhase() const; int skyGetSecundaPhase() const;
void skySetMoonColour (bool red); void skySetMoonColour (bool red);
void configureAmbient(MWWorld::Ptr::CellStore &mCell); void configureAmbient(MWWorld::CellStore &mCell);
void requestMap (MWWorld::Ptr::CellStore* cell); void requestMap (MWWorld::CellStore* cell);
///< request the local map for a cell ///< request the local map for a cell
/// configure fog according to cell /// configure fog according to cell
void configureFog(MWWorld::Ptr::CellStore &mCell); void configureFog(MWWorld::CellStore &mCell);
/// configure fog manually /// configure fog manually
void configureFog(const float density, const Ogre::ColourValue& colour); void configureFog(const float density, const Ogre::ColourValue& colour);

View file

@ -3,6 +3,8 @@
#include <OgreTerrain.h> #include <OgreTerrain.h>
#include <OgreTerrainGroup.h> #include <OgreTerrainGroup.h>
#include <components/esm_store/store.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"

View file

@ -3,9 +3,10 @@
#include <OgreTerrain.h> #include <OgreTerrain.h>
#include <OgreTerrainGroup.h> #include <OgreTerrainGroup.h>
#include "terrainmaterial.hpp"
#include "../mwworld/ptr.hpp" #include <components/esm/loadland.hpp>
#include "terrainmaterial.hpp"
namespace Ogre{ namespace Ogre{
class SceneManager; class SceneManager;
@ -14,6 +15,11 @@ namespace Ogre{
class Terrain; class Terrain;
} }
namespace MWWorld
{
class CellStore;
}
namespace MWRender{ namespace MWRender{
class RenderingManager; class RenderingManager;
@ -32,8 +38,8 @@ namespace MWRender{
void setDiffuse(const Ogre::ColourValue& diffuse); void setDiffuse(const Ogre::ColourValue& diffuse);
void setAmbient(const Ogre::ColourValue& ambient); void setAmbient(const Ogre::ColourValue& ambient);
void cellAdded(MWWorld::Ptr::CellStore* store); void cellAdded(MWWorld::CellStore* store);
void cellRemoved(MWWorld::Ptr::CellStore* store); void cellRemoved(MWWorld::CellStore* store);
private: private:
Ogre::TerrainGlobalOptions* mTerrainGlobals; Ogre::TerrainGlobalOptions* mTerrainGlobals;
Ogre::TerrainGroup mTerrainGroup; Ogre::TerrainGroup mTerrainGroup;

View file

@ -130,7 +130,7 @@ namespace MWSound
void stopSound3D(MWWorld::Ptr reference); void stopSound3D(MWWorld::Ptr reference);
///< Stop the given object from playing all sounds. ///< Stop the given object from playing all sounds.
void stopSound(const MWWorld::Ptr::CellStore *cell); void stopSound(const MWWorld::CellStore *cell);
///< Stop all sounds for the given cell. ///< Stop all sounds for the given cell.
void stopSound(const std::string& soundId); void stopSound(const std::string& soundId);

View file

@ -13,6 +13,8 @@ namespace ESMS
namespace MWWorld namespace MWWorld
{ {
class CellStore;
/// \brief List of active local scripts /// \brief List of active local scripts
class LocalScripts class LocalScripts
{ {
@ -41,13 +43,13 @@ namespace MWWorld
void add (const std::string& scriptName, const Ptr& ptr); void add (const std::string& scriptName, const Ptr& ptr);
///< Add script to collection of active local scripts. ///< Add script to collection of active local scripts.
void addCell (Ptr::CellStore *cell); void addCell (CellStore *cell);
///< Add all local scripts in a cell. ///< Add all local scripts in a cell.
void clear(); void clear();
///< Clear active local scripts collection. ///< Clear active local scripts collection.
void clearCell (Ptr::CellStore *cell); void clearCell (CellStore *cell);
///< Remove all scripts belonging to \a cell. ///< Remove all scripts belonging to \a cell.
void remove (const Ptr& ptr); void remove (const Ptr& ptr);

View file

@ -21,11 +21,13 @@ namespace MWRender
namespace MWWorld namespace MWWorld
{ {
class CellStore;
/// \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::CellStore *mCellStore;
MWRender::Player *mRenderer; MWRender::Player *mRenderer;
std::string mName; std::string mName;
bool mMale; bool mMale;
@ -46,7 +48,7 @@ namespace MWWorld
/// Set where the player is looking at. Uses Morrowind (euler) angles /// Set where the player is looking at. Uses Morrowind (euler) angles
void setRot(float x, float y, float z); void setRot(float x, float y, float z);
void setCell (MWWorld::Ptr::CellStore *cellStore) void setCell (MWWorld::CellStore *cellStore)
{ {
mCellStore = cellStore; mCellStore = cellStore;
} }

View file

@ -338,7 +338,7 @@ namespace MWWorld
/// \todo this whole code needs major clean up, and doesn't belong in this class. /// \todo this whole code needs major clean up, and doesn't belong in this class.
void Scene::insertObject(MWWorld::Ptr ptr, Ptr::CellStore* cell) void Scene::insertObject (const Ptr& ptr, CellStore* cell)
{ {
std::string type = ptr.getTypeName(); std::string type = ptr.getTypeName();

View file

@ -12,8 +12,6 @@
#include "../mwrender/renderinginterface.hpp" #include "../mwrender/renderinginterface.hpp"
#include "physicssystem.hpp" #include "physicssystem.hpp"
#include "refdata.hpp"
#include "ptr.hpp"
#include "globals.hpp" #include "globals.hpp"
namespace Ogre namespace Ogre
@ -45,24 +43,25 @@ namespace MWRender
namespace MWWorld namespace MWWorld
{ {
class Player; class Player;
class CellStore;
class Ptr;
class Scene class Scene
{ {
public: public:
typedef std::set<Ptr::CellStore *> CellStoreCollection; typedef std::set<CellStore *> CellStoreCollection;
private: private:
//OEngine::Render::OgreRenderer& mRenderer; //OEngine::Render::OgreRenderer& mRenderer;
Ptr::CellStore* mCurrentCell; // the cell, the player is in CellStore* mCurrentCell; // the cell, the player is in
CellStoreCollection mActiveCells; CellStoreCollection mActiveCells;
bool mCellChanged; bool mCellChanged;
PhysicsSystem *mPhysics; PhysicsSystem *mPhysics;
MWRender::RenderingManager& mRendering; MWRender::RenderingManager& mRendering;
void playerCellChange (Ptr::CellStore *cell, const ESM::Position& position, void playerCellChange (CellStore *cell, const ESM::Position& position,
bool adjustPlayerPos = true); bool adjustPlayerPos = true);
@ -74,13 +73,13 @@ namespace MWWorld
void unloadCell (CellStoreCollection::iterator iter); void unloadCell (CellStoreCollection::iterator iter);
void loadCell (Ptr::CellStore *cell); void loadCell (CellStore *cell);
void changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos); void changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos);
///< Move from exterior to interior or from interior cell to a different ///< Move from exterior to interior or from interior cell to a different
/// interior cell. /// interior cell.
Ptr::CellStore* getCurrentCell (); CellStore* getCurrentCell ();
const CellStoreCollection& getActiveCells () const; const CellStoreCollection& getActiveCells () const;
@ -99,7 +98,7 @@ namespace MWWorld
/// this method is only meant for dropping objects into the gameworld from a container /// this method is only meant for dropping objects into the gameworld from a container
/// and thus only handles object types that can be placed in a container /// and thus only handles object types that can be placed in a container
void insertObject(MWWorld::Ptr object, Ptr::CellStore* cell); void insertObject (const Ptr& object, CellStore* cell);
void update (float duration); void update (float duration);