Commit 33b6a0b8 authored by Marc Zinnschlag's avatar Marc Zinnschlag

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

parent 9d6e658e
......@@ -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()
{
......
#ifndef GAME_MWWORLD_ACTIVATOR_H
#define GAME_MWWORLD_ACTIVATOR_H
#ifndef GAME_MWCLASS_ACTIVATOR_H
#define GAME_MWCLASS_ACTIVATOR_H
#include "class.hpp"
#include "../mwworld/class.hpp"
namespace MWWorld
namespace MWClass
{
class Activator : public Class
class Activator : public MWWorld::Class
{
public:
......
......@@ -5,7 +5,7 @@
#include "creature.hpp"
#include "npc.hpp"
namespace MWWorld
namespace MWClass
{
void registerClasses()
{
......
#ifndef GAME_MWWORLD_CLASSES_H
#define GAME_MWWORLD_CLASSES_H
#ifndef GAME_MWCLASS_CLASSES_H
#define GAME_MWCLASS_CLASSES_H
namespace MWWorld
namespace MWClass
{
void registerClasses();
///< register all known classes
......
......@@ -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);
......
#ifndef GAME_MWWORLD_CREATURE_H
#define GAME_MWWORLD_CREATURE_H
#ifndef GAME_MWCLASS_CREATURE_H
#define GAME_MWCLASS_CREATURE_H
#include "class.hpp"
#include "../mwworld/class.hpp"
namespace MWWorld
namespace MWClass
{
class Creature : public Class
class Creature : 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();
......
......@@ -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);
......
#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();
......
#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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment