moved the CellRef struct to its own header

This commit is contained in:
Marc Zinnschlag 2013-04-04 12:13:15 +02:00
parent e8c32d0c3d
commit 8c7d578ddc
4 changed files with 93 additions and 79 deletions

View file

@ -1,7 +1,7 @@
#ifndef GAME_MWWORLD_LIVECELLREF_H #ifndef GAME_MWWORLD_LIVECELLREF_H
#define GAME_MWWORLD_LIVECELLREF_H #define GAME_MWWORLD_LIVECELLREF_H
#include <components/esm/loadcell.hpp> #include <components/esm/cellref.hpp>
#include "refdata.hpp" #include "refdata.hpp"

View file

@ -39,7 +39,7 @@ add_component_dir (esm
loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst
loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc
loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat
loadweap records aipackage effectlist spelllist variant variantimp loadtes3 loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref
) )
add_component_dir (misc add_component_dir (misc

View file

@ -0,0 +1,90 @@
#ifndef OPENMW_ESM_CELLREF_H
#define OPENMW_ESM_CELLREF_H
#include <string>
#include "defs.hpp"
namespace ESM
{
class ESMWriter;
/* Cell reference. This represents ONE object (of many) inside the
cell. The cell references are not loaded as part of the normal
loading process, but are rather loaded later on demand when we are
setting up a specific cell.
*/
class CellRef
{
public:
int mRefnum; // Reference number
std::string mRefID; // ID of object being referenced
float mScale; // Scale applied to mesh
// The NPC that owns this object (and will get angry if you steal
// it)
std::string mOwner;
// I have no idea, looks like a link to a global variable?
std::string mGlob;
// ID of creature trapped in this soul gem (?)
std::string mSoul;
// ?? CNAM has a faction name, might be for objects/beds etc
// belonging to a faction.
std::string mFaction;
// INDX might be PC faction rank required to use the item? Sometimes
// is -1, which I assume means "any rank".
int mFactIndex;
// For weapon or armor, this is the remaining item health.
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
int mCharge;
// Remaining enchantment charge
float mEnchantmentCharge;
// This is 5 for Gold_005 references, 100 for Gold_100 and so on.
int mGoldValue;
// For doors - true if this door teleports to somewhere else, false
// if it should open through animation.
bool mTeleport;
// Teleport location for the door, if this is a teleporting door.
Position mDoorDest;
// Destination cell for doors (optional)
std::string mDestCell;
// Lock level for doors and containers
int mLockLevel;
std::string mKey, mTrap; // Key and trap ID names, if any
// This corresponds to the "Reference Blocked" checkbox in the construction set,
// which prevents editing that reference.
// -1 is not blocked, otherwise it is blocked.
signed char mReferenceBlocked;
// Track deleted references. 0 - not deleted, 1 - deleted, but respawns, 2 - deleted and does not respawn.
int mDeleted;
// Occurs in Tribunal.esm, eg. in the cell "Mournhold, Plaza
// Brindisi Dorom", where it has the value 100. Also only for
// activators.
int mFltv;
int mNam0;
// Position and rotation of this object within the cell
Position mPos;
void save(ESMWriter &esm);
};
}
#endif

View file

@ -7,95 +7,19 @@
#include "esmcommon.hpp" #include "esmcommon.hpp"
#include "defs.hpp" #include "defs.hpp"
#include "cellref.hpp"
namespace MWWorld namespace MWWorld
{ {
class ESMStore; class ESMStore;
} }
namespace ESM namespace ESM
{ {
class ESMReader; class ESMReader;
class ESMWriter; class ESMWriter;
/* Cell reference. This represents ONE object (of many) inside the
cell. The cell references are not loaded as part of the normal
loading process, but are rather loaded later on demand when we are
setting up a specific cell.
*/
class CellRef
{
public:
int mRefnum; // Reference number
std::string mRefID; // ID of object being referenced
float mScale; // Scale applied to mesh
// The NPC that owns this object (and will get angry if you steal
// it)
std::string mOwner;
// I have no idea, looks like a link to a global variable?
std::string mGlob;
// ID of creature trapped in this soul gem (?)
std::string mSoul;
// ?? CNAM has a faction name, might be for objects/beds etc
// belonging to a faction.
std::string mFaction;
// INDX might be PC faction rank required to use the item? Sometimes
// is -1, which I assume means "any rank".
int mFactIndex;
// For weapon or armor, this is the remaining item health.
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
int mCharge;
// Remaining enchantment charge
float mEnchantmentCharge;
// This is 5 for Gold_005 references, 100 for Gold_100 and so on.
int mGoldValue;
// For doors - true if this door teleports to somewhere else, false
// if it should open through animation.
bool mTeleport;
// Teleport location for the door, if this is a teleporting door.
Position mDoorDest;
// Destination cell for doors (optional)
std::string mDestCell;
// Lock level for doors and containers
int mLockLevel;
std::string mKey, mTrap; // Key and trap ID names, if any
// This corresponds to the "Reference Blocked" checkbox in the construction set,
// which prevents editing that reference.
// -1 is not blocked, otherwise it is blocked.
signed char mReferenceBlocked;
// Track deleted references. 0 - not deleted, 1 - deleted, but respawns, 2 - deleted and does not respawn.
int mDeleted;
// Occurs in Tribunal.esm, eg. in the cell "Mournhold, Plaza
// Brindisi Dorom", where it has the value 100. Also only for
// activators.
int mFltv;
int mNam0;
// Position and rotation of this object within the cell
Position mPos;
void save(ESMWriter &esm);
};
/* Moved cell reference tracking object. This mainly stores the target cell /* Moved cell reference tracking object. This mainly stores the target cell
of the reference, so we can easily know where it has been moved when another of the reference, so we can easily know where it has been moved when another
plugin tries to move it independently. plugin tries to move it independently.