moved concrete record classes to separate sub-system (mwclass)

pull/7/head
Marc Zinnschlag 15 years ago
parent 9d6e658e05
commit 33b6a0b800

@ -80,10 +80,6 @@ set(GAMEWORLD
mwworld/world.cpp
mwworld/globals.cpp
mwworld/class.cpp
mwworld/classes.cpp
mwworld/activator.cpp
mwworld/creature.cpp
mwworld/npc.cpp
)
set(GAMEWORLD_HEADER
mwworld/refdata.hpp
@ -92,13 +88,23 @@ set(GAMEWORLD_HEADER
mwworld/environment.hpp
mwworld/globals.hpp
mwworld/class.hpp
mwworld/classes.hpp
mwworld/activator.hpp
mwworld/creature.hpp
mwworld/npc.hpp
)
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
set(GAMECLASS
mwclass/classes.cpp
mwclass/activator.cpp
mwclass/creature.cpp
mwclass/npc.cpp
)
set(GAMECLASS_HEADER
mwclass/classes.hpp
mwclass/activator.hpp
mwclass/creature.hpp
mwclass/npc.hpp
)
source_group(apps\\openmw\\mwclass FILES ${GAMECLASS} ${GAMECLASS_HEADER})
set(GAMEMECHANICS
mwmechanics/mechanicsmanager.cpp)
set(GAMEMECHANICS_HEADER
@ -109,10 +115,11 @@ set(GAMEMECHANICS_HEADER
source_group(apps\\openmw\\mwmechanics FILES ${GAMEMECHANICS} ${GAMEMECHANICS_HEADER})
set(OPENMW_CPP ${GAME} ${GAMEREND} ${GAMEINPUT} ${GAMESCRIPT} ${GAMESOUND} ${GAMEGUI} ${GAMEWORLD}
${GAMEMECHANICS}
${GAMECLASS} ${GAMEMECHANICS}
)
set(OPENMW_HEADER ${GAME_HEADER} ${GAMEREND_HEADER} ${GAMEINPUT_HEADER} ${GAMESCRIPT_HEADER}
${GAMESOUND_HEADER} ${GAMEGUI_HEADER} ${GAMEWORLD_HEADER} ${GAMEMECHANICS_HEADER}
${GAMESOUND_HEADER} ${GAMEGUI_HEADER} ${GAMEWORLD_HEADER} ${GAMECLASS_HEADER}
${GAMEMECHANICS_HEADER}
)
# Main executable

@ -23,7 +23,8 @@
#include "mwworld/world.hpp"
#include "mwworld/ptr.hpp"
#include "mwworld/environment.hpp"
#include "mwworld/classes.hpp"
#include "mwclass/classes.hpp"
#include "mwmechanics/mechanicsmanager.hpp"
@ -79,7 +80,7 @@ OMW::Engine::Engine()
, mScriptManager (0)
, mScriptContext (0)
{
MWWorld::registerClasses();
MWClass::registerClasses();
}
OMW::Engine::~Engine()

@ -3,7 +3,7 @@
#include <components/esm/loadacti.hpp>
namespace MWWorld
namespace MWClass
{
void Activator::registerSelf()
{

@ -0,0 +1,17 @@
#ifndef GAME_MWCLASS_ACTIVATOR_H
#define GAME_MWCLASS_ACTIVATOR_H
#include "../mwworld/class.hpp"
namespace MWClass
{
class Activator : public MWWorld::Class
{
public:
static void registerSelf();
};
}
#endif

@ -5,7 +5,7 @@
#include "creature.hpp"
#include "npc.hpp"
namespace MWWorld
namespace MWClass
{
void registerClasses()
{

@ -0,0 +1,10 @@
#ifndef GAME_MWCLASS_CLASSES_H
#define GAME_MWCLASS_CLASSES_H
namespace MWClass
{
void registerClasses();
///< register all known classes
}
#endif

@ -5,18 +5,18 @@
#include "../mwmechanics/creaturestats.hpp"
#include "ptr.hpp"
#include "../mwworld/ptr.hpp"
namespace MWWorld
namespace MWClass
{
MWMechanics::CreatureStats& Creature::getCreatureStats (const Ptr& ptr) const
MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const
{
if (!ptr.getRefData().getCreatureStats().get())
{
boost::shared_ptr<MWMechanics::CreatureStats> stats (
new MWMechanics::CreatureStats);
ESMS::LiveCellRef<ESM::Creature, RefData> *ref = ptr.get<ESM::Creature>();
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref = ptr.get<ESM::Creature>();
stats->mAttributes[0].set (ref->base->data.strength);
stats->mAttributes[1].set (ref->base->data.intelligence);

@ -0,0 +1,19 @@
#ifndef GAME_MWCLASS_CREATURE_H
#define GAME_MWCLASS_CREATURE_H
#include "../mwworld/class.hpp"
namespace MWClass
{
class Creature : public MWWorld::Class
{
public:
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
///< Return creature stats
static void registerSelf();
};
}
#endif

@ -3,18 +3,18 @@
#include <components/esm/loadnpc.hpp>
#include "ptr.hpp"
#include "../mwworld/ptr.hpp"
namespace MWWorld
namespace MWClass
{
MWMechanics::CreatureStats& Npc::getCreatureStats (const Ptr& ptr) const
MWMechanics::CreatureStats& Npc::getCreatureStats (const MWWorld::Ptr& ptr) const
{
if (!ptr.getRefData().getCreatureStats().get())
{
boost::shared_ptr<MWMechanics::CreatureStats> stats (
new MWMechanics::CreatureStats);
ESMS::LiveCellRef<ESM::NPC, RefData> *ref = ptr.get<ESM::NPC>();
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref = ptr.get<ESM::NPC>();
stats->mAttributes[0].set (ref->base->npdt52.strength);
stats->mAttributes[1].set (ref->base->npdt52.intelligence);

@ -1,15 +1,15 @@
#ifndef GAME_MWWORLD_NPC_H
#define GAME_MWWORLD_NPC_H
#ifndef GAME_MWCLASS_NPC_H
#define GAME_MWCLASS_NPC_H
#include "class.hpp"
#include "../mwworld/class.hpp"
namespace MWWorld
namespace MWClass
{
class Npc : public Class
class Npc : public MWWorld::Class
{
public:
virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const;
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
///< Return creature stats
static void registerSelf();

@ -1,14 +0,0 @@
#include "activator.hpp"
#include <components/esm/loadacti.hpp>
namespace MWWorld
{
void Activator::registerSelf()
{
boost::shared_ptr<Class> instance (new Activator);
registerClass (typeid (ESM::Activator).name(), instance);
}
}

@ -1,17 +0,0 @@
#ifndef GAME_MWWORLD_ACTIVATOR_H
#define GAME_MWWORLD_ACTIVATOR_H
#include "class.hpp"
namespace MWWorld
{
class Activator : public Class
{
public:
static void registerSelf();
};
}
#endif

@ -1,10 +0,0 @@
#ifndef GAME_MWWORLD_CLASSES_H
#define GAME_MWWORLD_CLASSES_H
namespace MWWorld
{
void registerClasses();
///< register all known classes
}
#endif

@ -1,19 +0,0 @@
#ifndef GAME_MWWORLD_CREATURE_H
#define GAME_MWWORLD_CREATURE_H
#include "class.hpp"
namespace MWWorld
{
class Creature : public Class
{
public:
virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const;
///< Return creature stats
static void registerSelf();
};
}
#endif
Loading…
Cancel
Save