rm record inheritance, rework esmtool accordingly

pull/37/head
greye 12 years ago
parent 1339787863
commit 721324c1db

@ -1,5 +1,7 @@
set(ESMTOOL
esmtool.cpp
record.hpp
record.cpp
)
source_group(apps\\esmtool FILES ${ESMTOOL})

File diff suppressed because it is too large Load Diff

@ -0,0 +1,568 @@
#include "record.hpp"
#include <iostream>
namespace EsmTool {
RecordBase *
RecordBase::create(int type)
{
RecordBase *record = 0;
switch (type) {
case ESM::REC_ACTI:
{
record = new EsmTool::Record<ESM::Activator>;
break;
}
case ESM::REC_ALCH:
{
record = new EsmTool::Record<ESM::Potion>;
break;
}
case ESM::REC_APPA:
{
record = new EsmTool::Record<ESM::Apparatus>;
break;
}
case ESM::REC_ARMO:
{
record = new EsmTool::Record<ESM::Armor>;
break;
}
case ESM::REC_BODY:
{
record = new EsmTool::Record<ESM::BodyPart>;
break;
}
case ESM::REC_BOOK:
{
record = new EsmTool::Record<ESM::Book>;
break;
}
case ESM::REC_BSGN:
{
record = new EsmTool::Record<ESM::BirthSign>;
break;
}
case ESM::REC_CELL:
{
record = new EsmTool::Record<ESM::Cell>;
break;
}
case ESM::REC_CLAS:
{
record = new EsmTool::Record<ESM::Class>;
break;
}
case ESM::REC_CLOT:
{
record = new EsmTool::Record<ESM::Clothing>;
break;
}
case ESM::REC_CONT:
{
record = new EsmTool::Record<ESM::Container>;
break;
}
case ESM::REC_CREA:
{
record = new EsmTool::Record<ESM::Creature>;
break;
}
case ESM::REC_DIAL:
{
record = new EsmTool::Record<ESM::Dialogue>;
break;
}
case ESM::REC_DOOR:
{
record = new EsmTool::Record<ESM::Door>;
break;
}
case ESM::REC_ENCH:
{
record = new EsmTool::Record<ESM::Enchantment>;
break;
}
case ESM::REC_FACT:
{
record = new EsmTool::Record<ESM::Faction>;
break;
}
case ESM::REC_GLOB:
{
record = new EsmTool::Record<ESM::Global>;
break;
}
case ESM::REC_GMST:
{
record = new EsmTool::Record<ESM::GameSetting>;
break;
}
case ESM::REC_INFO:
{
record = new EsmTool::Record<ESM::DialInfo>;
break;
}
case ESM::REC_INGR:
{
record = new EsmTool::Record<ESM::Ingredient>;
break;
}
case ESM::REC_LAND:
{
record = new EsmTool::Record<ESM::Land>;
break;
}
case ESM::REC_LEVI:
{
record = new EsmTool::Record<ESM::ItemLevList>;
break;
}
case ESM::REC_LEVC:
{
record = new EsmTool::Record<ESM::CreatureLevList>;
break;
}
case ESM::REC_LIGH:
{
record = new EsmTool::Record<ESM::Light>;
break;
}
case ESM::REC_LOCK:
{
record = new EsmTool::Record<ESM::Tool>;
break;
}
case ESM::REC_LTEX:
{
record = new EsmTool::Record<ESM::LandTexture>;
break;
}
case ESM::REC_MISC:
{
record = new EsmTool::Record<ESM::Miscellaneous>;
break;
}
case ESM::REC_MGEF:
{
record = new EsmTool::Record<ESM::MagicEffect>;
break;
}
case ESM::REC_NPC_:
{
record = new EsmTool::Record<ESM::NPC>;
break;
}
case ESM::REC_PGRD:
{
record = new EsmTool::Record<ESM::Pathgrid>;
break;
}
case ESM::REC_PROB:
{
record = new EsmTool::Record<ESM::Probe>;
break;
}
case ESM::REC_RACE:
{
record = new EsmTool::Record<ESM::Race>;
break;
}
case ESM::REC_REGN:
{
record = new EsmTool::Record<ESM::Region>;
break;
}
case ESM::REC_REPA:
{
record = new EsmTool::Record<ESM::Repair>;
break;
}
case ESM::REC_SCPT:
{
record = new EsmTool::Record<ESM::Script>;
break;
}
case ESM::REC_SKIL:
{
record = new EsmTool::Record<ESM::Skill>;
break;
}
case ESM::REC_SNDG:
{
record = new EsmTool::Record<ESM::SoundGenerator>;
break;
}
case ESM::REC_SOUN:
{
record = new EsmTool::Record<ESM::Sound>;
break;
}
case ESM::REC_SPEL:
{
record = new EsmTool::Record<ESM::Spell>;
break;
}
case ESM::REC_STAT:
{
record = new EsmTool::Record<ESM::Static>;
break;
}
case ESM::REC_WEAP:
{
record = new EsmTool::Record<ESM::Weapon>;
break;
}
case ESM::REC_SSCR:
{
record = new EsmTool::Record<ESM::StartScript>;
break;
}
default:
record = 0;
}
if (record) {
record->mType = type;
}
return record;
}
template<>
void Record<ESM::Activator>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
std::cout << " Script: " << mData.mScript << std::endl;
}
template<>
void Record<ESM::Potion>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Armor>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
std::cout << " Icon: " << mData.mIcon << std::endl;
std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " Enchantment: " << mData.mEnchant << std::endl;
std::cout << " Type: " << mData.mData.mType << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl;
}
template<>
void Record<ESM::Apparatus>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::BodyPart>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
}
template<>
void Record<ESM::Book>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
}
template<>
void Record<ESM::BirthSign>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Texture: " << mData.mTexture << std::endl;
std::cout << " Description: " << mData.mDescription << std::endl;
}
template<>
void Record<ESM::Cell>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Region: " << mData.mRegion << std::endl;
}
template<>
void Record<ESM::Class>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Description: " << mData.mDescription << std::endl;
}
template<>
void Record<ESM::Clothing>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Container>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Creature>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Dialogue>::print()
{
// nothing to print
}
template<>
void Record<ESM::Door>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Mesh: " << mData.mModel << std::endl;
std::cout << " Script: " << mData.mScript << std::endl;
std::cout << " OpenSound: " << mData.mOpenSound << std::endl;
std::cout << " CloseSound: " << mData.mCloseSound << std::endl;
}
template<>
void Record<ESM::Enchantment>::print()
{
// nothing to print
}
template<>
void Record<ESM::Faction>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Attr1: " << mData.mData.mAttribute1 << std::endl;
std::cout << " Attr2: " << mData.mData.mAttribute2 << std::endl;
std::cout << " Hidden: " << mData.mData.mIsHidden << std::endl;
}
template<>
void Record<ESM::Global>::print()
{
// nothing to print
}
template<>
void Record<ESM::GameSetting>::print()
{
std::cout << " Value: ";
switch (mData.mType) {
case ESM::VT_String:
std::cout << "'" << mData.mStr << "' (std::string)";
break;
case ESM::VT_Float:
std::cout << mData.mF << " (float)";
break;
case ESM::VT_Int:
std::cout << mData.mI << " (int)";
break;
default:
std::cout << "unknown type";
}
std::cout << "\n Dirty: " << mData.mDirty << std::endl;
}
template<>
void Record<ESM::DialInfo>::print()
{
std::cout << " Id: " << mData.mId << std::endl;
std::cout << " Text: " << mData.mResponse << std::endl;
}
template<>
void Record<ESM::Ingredient>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::Land>::print()
{
std::cout << " Coords: [" << mData.mX << "," << mData.mY << "]" << std::endl;
}
template<>
void Record<ESM::CreatureLevList>::print()
{
std::cout << " Number of items: " << mData.mList.size() << std::endl;
}
template<>
void Record<ESM::ItemLevList>::print()
{
std::cout << " Number of items: " << mData.mList.size() << std::endl;
}
template<>
void Record<ESM::Light>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Weight: " << mData.mData.mWeight << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::Tool>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl;
}
template<>
void Record<ESM::Probe>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl;
}
template<>
void Record<ESM::Repair>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Quality: " << mData.mData.mQuality << std::endl;
}
template<>
void Record<ESM::LandTexture>::print()
{
std::cout << " Id: " << mData.mId << std::endl;
std::cout << " Texture: " << mData.mTexture << std::endl;
}
template<>
void Record<ESM::MagicEffect>::print()
{
std::cout << " Index: " << mData.mIndex << std::endl;
const char *text = "Positive";
if (mData.mData.mFlags & ESM::MagicEffect::Negative) {
text = "Negative";
}
std::cout << " " << text << std::endl;
}
template<>
void Record<ESM::Miscellaneous>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::NPC>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Race: " << mData.mRace << std::endl;
}
template<>
void Record<ESM::Pathgrid>::print()
{
std::cout << " Cell: " << mData.mCell << std::endl;
std::cout << " Point count: " << mData.mPoints.size() << std::endl;
std::cout << " Edge count: " << mData.mEdges.size() << std::endl;
}
template<>
void Record<ESM::Race>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Length: " << mData.mData.mHeight.mMale << "m " << mData.mData.mHeight.mFemale << "f" << std::endl;
}
template<>
void Record<ESM::Region>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::Script>::print()
{
std::cout << " Name: " << mData.mData.mName.toString() << std::endl;
}
template<>
void Record<ESM::Skill>::print()
{
std::cout << " ID: " << mData.mIndex << std::endl;
const char *spec = 0;
int specId = mData.mData.mSpecialization;
if (specId == 0) {
spec = "Combat";
} else if (specId == 1) {
spec = "Magic";
} else {
spec = "Stealth";
}
std::cout << " Type: " << spec << std::endl;
}
template<>
void Record<ESM::SoundGenerator>::print()
{
std::cout << " Creature: " << mData.mCreature << std::endl;
std::cout << " Sound: " << mData.mSound << std::endl;
}
template<>
void Record<ESM::Sound>::print()
{
std::cout << " Sound: " << mData.mSound << std::endl;
std::cout << " Volume: " << mData.mData.mVolume << std::endl;
}
template<>
void Record<ESM::Spell>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
}
template<>
void Record<ESM::StartScript>::print()
{
std::cout << "Start script: " << mData.mScript << std::endl;
}
template<>
void Record<ESM::Static>::print()
{
std::cout << " Model: " << mData.mModel << std::endl;
}
template<>
void Record<ESM::Weapon>::print()
{
std::cout << " Name: " << mData.mName << std::endl;
std::cout << " Chop: " << mData.mData.mChop[0] << "-" << mData.mData.mChop[1] << std::endl;
std::cout << " Slash: " << mData.mData.mSlash[0] << "-" << mData.mData.mSlash[1] << std::endl;
std::cout << " Thrust: " << mData.mData.mThrust[0] << "-" << mData.mData.mThrust[1] << std::endl;
std::cout << " Value: " << mData.mData.mValue << std::endl;
}
template<>
void Record<ESM::CellRef>::print()
{
std::cout << " Refnum: " << mData.mRefnum << std::endl;
std::cout << " ID: '" << mData.mRefID << "'\n";
std::cout << " Owner: '" << mData.mOwner << "'\n";
std::cout << " INTV: " << mData.mIntv << " NAM9: " << mData.mIntv << std::endl;
}
} // end namespace

@ -0,0 +1,127 @@
#ifndef OPENMW_ESMTOOL_RECORD_H
#define OPENMW_ESMTOOL_RECORD_H
#include <string>
#include <components/esm/records.hpp>
namespace ESM
{
class ESMReader;
class ESMWriter;
}
namespace EsmTool
{
template <class T> class Record;
class RecordBase
{
protected:
std::string mId;
int mFlags;
int mType;
public:
RecordBase () {}
virtual ~RecordBase() {}
const std::string &getId() const {
return mId;
}
void setId(const std::string &id) {
mId = id;
}
int getFlags() const {
return mFlags;
}
void setFlags(int flags) {
mFlags = flags;
}
int getType() const {
return mType;
}
virtual void load(ESM::ESMReader &esm) = 0;
virtual void save(ESM::ESMWriter &esm) = 0;
virtual void print() = 0;
static RecordBase *create(int type);
// just make it a bit shorter
template <class T>
Record<T> *cast() {
return static_cast<Record<T> *>(this);
}
};
template <class T>
class Record : public RecordBase
{
T mData;
public:
T &get() {
return mData;
}
void save(ESM::ESMWriter &esm) {
mData.save(esm);
}
void load(ESM::ESMReader &esm) {
mData.load(esm);
}
void print();
};
template<> void Record<ESM::Activator>::print();
template<> void Record<ESM::Potion>::print();
template<> void Record<ESM::Armor>::print();
template<> void Record<ESM::Apparatus>::print();
template<> void Record<ESM::BodyPart>::print();
template<> void Record<ESM::Book>::print();
template<> void Record<ESM::BirthSign>::print();
template<> void Record<ESM::Cell>::print();
template<> void Record<ESM::Class>::print();
template<> void Record<ESM::Clothing>::print();
template<> void Record<ESM::Container>::print();
template<> void Record<ESM::Creature>::print();
template<> void Record<ESM::Dialogue>::print();
template<> void Record<ESM::Door>::print();
template<> void Record<ESM::Enchantment>::print();
template<> void Record<ESM::Faction>::print();
template<> void Record<ESM::Global>::print();
template<> void Record<ESM::GameSetting>::print();
template<> void Record<ESM::DialInfo>::print();
template<> void Record<ESM::Ingredient>::print();
template<> void Record<ESM::Land>::print();
template<> void Record<ESM::CreatureLevList>::print();
template<> void Record<ESM::ItemLevList>::print();
template<> void Record<ESM::Light>::print();
template<> void Record<ESM::Tool>::print();
template<> void Record<ESM::Probe>::print();
template<> void Record<ESM::Repair>::print();
template<> void Record<ESM::LandTexture>::print();
template<> void Record<ESM::MagicEffect>::print();
template<> void Record<ESM::Miscellaneous>::print();
template<> void Record<ESM::NPC>::print();
template<> void Record<ESM::Pathgrid>::print();
template<> void Record<ESM::Race>::print();
template<> void Record<ESM::Region>::print();
template<> void Record<ESM::Script>::print();
template<> void Record<ESM::Skill>::print();
template<> void Record<ESM::SoundGenerator>::print();
template<> void Record<ESM::Sound>::print();
template<> void Record<ESM::Spell>::print();
template<> void Record<ESM::StartScript>::print();
template<> void Record<ESM::Static>::print();
template<> void Record<ESM::Weapon>::print();
}
#endif

@ -81,7 +81,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->getId();
return ref->base->mId;
}
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const

@ -25,7 +25,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->getId();
return ref->base->mId;
}
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const

@ -120,7 +120,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->getId();
return ref->base->mId;
}
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const

@ -159,7 +159,7 @@ namespace MWClass
MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
boost::shared_ptr<MWWorld::Action> action (
new MWWorld::ActionApply (actor, ref->base->getId()));
new MWWorld::ActionApply (actor, ref->base->mId));
action->setSound ("Drink");

@ -22,7 +22,7 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->getId() == mInfoId)
if (iter->mId == mInfoId)
return iter->mResponse;
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
@ -41,7 +41,7 @@ namespace MWDialogue
iter!=dialogue->mInfo.end(); ++iter)
if (iter->mData.mDisposition==index) /// \todo cleanup info structure
{
return iter->getId();
return iter->mId;
}
throw std::runtime_error ("unknown journal index for topic " + topic);

@ -67,7 +67,7 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->getId() == entry.mInfoId)
if (iter->mId == entry.mInfoId)
{
index = iter->mData.mDisposition; /// \todo cleanup info structure
break;

@ -776,7 +776,7 @@ namespace MWWorld
stream << "$dynamic" << mNextDynamicRecord++;
ESM::Potion record2 (record);
record2.setId(stream.str());
record2.mId = stream.str();
const ESM::Potion *created =
&mStore.potions.list.insert (std::make_pair (stream.str(), record2)).first->second;

@ -6,14 +6,12 @@
namespace ESM
{
struct Activator : public Record
struct Activator
{
std::string mName, mScript, mModel;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_ACTI; }
};
}

@ -12,7 +12,7 @@ namespace ESM
* Alchemy item (potions)
*/
struct Potion : public Record
struct Potion
{
struct ALDTstruct
{
@ -22,13 +22,11 @@ struct Potion : public Record
};
ALDTstruct mData;
std::string mName, mModel, mIcon, mScript;
std::string mId, mName, mModel, mIcon, mScript;
EffectList mEffects;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_ALCH; }
};
};
}
#endif

@ -9,7 +9,7 @@ namespace ESM
* Alchemist apparatus
*/
struct Apparatus : public Record
struct Apparatus
{
enum AppaType
{
@ -32,8 +32,6 @@ struct Apparatus : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_APPA; }
};
}
#endif

@ -56,7 +56,7 @@ struct PartReferenceList
void save(ESMWriter &esm);
};
struct Armor : public Record
struct Armor
{
enum Type
{
@ -87,8 +87,6 @@ struct Armor : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_ARMO; }
};
}
#endif

@ -6,7 +6,7 @@
namespace ESM
{
struct BodyPart : public Record
struct BodyPart
{
enum MeshPart
{
@ -53,8 +53,6 @@ struct BodyPart : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_BODY; }
};
}
#endif

@ -9,7 +9,7 @@ namespace ESM
* Books, magic scrolls, notes and so on
*/
struct Book : public Record
struct Book
{
struct BKDTstruct
{
@ -22,8 +22,6 @@ struct Book : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_BOOK; }
};
};
}
#endif

@ -9,7 +9,7 @@
namespace ESM
{
struct BirthSign : public Record
struct BirthSign
{
std::string mName, mDescription, mTexture;
@ -18,8 +18,6 @@ struct BirthSign : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_BSGN; }
};
}
#endif

@ -102,6 +102,8 @@ void Cell::load(ESMReader &esm)
{
// Exterior cells
mRegion = esm.getHNOString("RGNN");
mMapColor = 0;
esm.getHNOT(mMapColor, "NAM5");
}
if (esm.isNextSub("NAM0")) {

@ -87,7 +87,7 @@ public:
(using ESMReader::getContext()) and jumping back into place
whenever we need to load a given cell.
*/
struct Cell : public Record
struct Cell
{
enum Flags
{
@ -128,8 +128,6 @@ struct Cell : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_CELL; }
bool isExterior() const
{
return !(mData.mFlags & Interior);

@ -13,7 +13,7 @@ namespace ESM
// These flags tells us which items should be auto-calculated for this
// class
struct Class : public Record
struct Class
{
enum AutoCalc
{
@ -63,8 +63,6 @@ struct Class : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_CLAS; }
};
}
#endif

@ -13,7 +13,7 @@ namespace ESM
* Clothing
*/
struct Clothing : public Record
struct Clothing
{
enum Type
{
@ -44,8 +44,6 @@ struct Clothing : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_CLOT; }
};
}
#endif

@ -28,7 +28,7 @@ struct InventoryList
void save(ESMWriter &esm);
};
struct Container : public Record
struct Container
{
enum Flags
{
@ -45,8 +45,6 @@ struct Container : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_CONT; }
};
}
#endif

@ -16,7 +16,7 @@ namespace ESM
*
*/
struct Creature : public Record
struct Creature
{
// Default is 0x48?
enum Flags
@ -69,7 +69,7 @@ struct Creature : public Record
int mFlags;
float mScale;
std::string mModel, mName, mScript;
std::string mId, mModel, mName, mScript;
std::string mOriginal; // Base creature that this is a modification of
InventoryList mInventory;
@ -80,8 +80,6 @@ struct Creature : public Record
AIData mAiData;
AIPackageList mAiPackage;
int getName() { return REC_CREA; }
void load(ESMReader &esm);
void save(ESMWriter &esm);
};

@ -12,7 +12,7 @@ namespace ESM {
*/
/// Changes a creature
struct LoadCREC : public Record
struct LoadCREC
{
void load(ESMReader &esm)
{
@ -22,12 +22,10 @@ struct LoadCREC : public Record
void save(ESMWriter &esm)
{
}
int getName() { return REC_CREC; }
};
/// Changes an item list / container
struct LoadCNTC : public Record
struct LoadCNTC
{
void load(ESMReader &esm)
{
@ -37,8 +35,6 @@ struct LoadCNTC : public Record
void save(ESMWriter &esm)
{
}
int getName() { return REC_CNTC; }
};
}
#endif

@ -14,7 +14,7 @@ namespace ESM
* the INFO records following the DIAL.
*/
struct Dialogue : public Record
struct Dialogue
{
enum Type
{
@ -26,13 +26,12 @@ struct Dialogue : public Record
Deleted = -1
};
std::string mId;
char mType;
std::vector<DialInfo> mInfo;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_DIAL; }
};
}
#endif

@ -8,14 +8,12 @@
namespace ESM
{
struct Door : public Record
struct Door
{
std::string mName, mModel, mScript, mOpenSound, mCloseSound;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_DOOR; }
};
}
#endif

@ -10,7 +10,7 @@ namespace ESM
* Enchantments
*/
struct Enchantment : public Record
struct Enchantment
{
enum Type
{
@ -34,8 +34,6 @@ struct Enchantment : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_ENCH; }
};
}
#endif

@ -26,9 +26,9 @@ struct RankData
int mFactReaction; // Reaction from faction members
};
struct Faction : public Record
struct Faction
{
std::string mName;
std::string mId, mName;
struct FADTstruct
{
@ -57,8 +57,6 @@ struct Faction : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_FACT; }
};
}
#endif

@ -11,15 +11,13 @@ namespace ESM
* Global script variables
*/
struct Global : public Record
struct Global
{
unsigned mValue;
VarType mType;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_GLOB; }
};
}
#endif

@ -13,8 +13,9 @@ namespace ESM
*
*/
struct GameSetting : public Record
struct GameSetting
{
std::string mId;
// One of these is used depending on the variable type
std::string mStr;
int mI;
@ -93,8 +94,6 @@ struct GameSetting : public Record
///< Throwns an exception if GMST is not of type string.
void save(ESMWriter &esm);
int getName() { return REC_GMST; }
};
}
#endif

@ -8,7 +8,7 @@ namespace ESM
void DialInfo::load(ESMReader &esm)
{
mSelfId = esm.getHNString("INAM");
mId = esm.getHNString("INAM");
mPrev = esm.getHNString("PNAM");
mNext = esm.getHNString("NNAM");
@ -127,7 +127,7 @@ void DialInfo::load(ESMReader &esm)
else
esm.fail(
"Don't know what to do with " + subName.toString()
+ " in INFO " + mSelfId);
+ " in INFO " + mId);
if (mQuestStatus != QS_None)
// Skip rest of record
@ -136,7 +136,7 @@ void DialInfo::load(ESMReader &esm)
void DialInfo::save(ESMWriter &esm)
{
esm.writeHNCString("INAM", mSelfId);
esm.writeHNCString("INAM", mId);
esm.writeHNCString("PNAM", mPrev);
esm.writeHNCString("NNAM", mNext);
esm.writeHNT("DATA", mData, 12);

@ -17,7 +17,7 @@ namespace ESM
* and form a linked list of dialogue items.
*/
struct DialInfo : public Record
struct DialInfo
{
enum Gender
{
@ -61,7 +61,7 @@ struct DialInfo : public Record
std::vector<SelectStruct> mSelects;
// Id of this, previous and next INFO items
std::string mSelfId, mPrev, mNext;
std::string mId, mPrev, mNext;
// Various references used in determining when to select this item.
std::string mActor, mRace, mClass, mNpcFaction, mPcFaction, mCell;
@ -102,8 +102,6 @@ struct DialInfo : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_INFO; }
};
/*

@ -11,7 +11,7 @@ namespace ESM
* Alchemy ingredient
*/
struct Ingredient : public Record
struct Ingredient
{
struct IRDTstruct
{
@ -23,12 +23,10 @@ struct Ingredient : public Record
};
IRDTstruct mData;
std::string mName, mModel, mIcon, mScript;
std::string mId, mName, mModel, mIcon, mScript;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_INGR; }
};
}
#endif

@ -12,7 +12,7 @@ namespace ESM
* Landscape data.
*/
struct Land : public Record
struct Land
{
Land();
~Land();
@ -92,8 +92,6 @@ struct Land : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_LAND; }
/**
* Actually loads data
*/

@ -17,7 +17,7 @@ namespace ESM
* several files.
*/
struct LeveledListBase : public Record
struct LeveledListBase
{
enum Flags
{
@ -47,14 +47,6 @@ struct LeveledListBase : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName()
{
if (mRecName[0] == 'C')
return REC_LEVC;
return REC_LEVI;
}
};
struct CreatureLevList: LeveledListBase

@ -13,7 +13,7 @@ namespace ESM
* and torches.
*/
struct Light : public Record
struct Light
{
enum Flags
{
@ -44,8 +44,6 @@ struct Light : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_LIGH; }
};
}
#endif

@ -11,7 +11,7 @@ namespace ESM
* items (REPA). These have nearly identical data structures.
*/
struct Tool : public Record
struct Tool
{
enum Type
{
@ -37,16 +37,6 @@ struct Tool : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName()
{
if (mType == Type_Probe)
return REC_PROB;
else if (mType == Type_Repair)
return REC_REPA;
else
return REC_LOCK;
}
};
struct Probe: Tool

@ -24,15 +24,13 @@ namespace ESM
* texture, and see if it affects the game.
*/
struct LandTexture : public Record
struct LandTexture
{
std::string mTexture;
std::string mId, mTexture;
int mIndex;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_LTEX; }
};
}
#endif

@ -8,7 +8,7 @@
namespace ESM
{
struct MagicEffect : public Record
struct MagicEffect
{
enum Flags
{
@ -50,8 +50,6 @@ struct MagicEffect : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_MGEF; }
};
}
#endif

@ -13,7 +13,7 @@ namespace ESM
* carried, bought and sold. It also includes keys.
*/
struct Miscellaneous : public Record
struct Miscellaneous
{
struct MCDTstruct
{
@ -29,8 +29,6 @@ struct Miscellaneous : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_MISC; }
};
}
#endif

@ -15,7 +15,7 @@ namespace ESM {
* NPC definition
*/
struct NPC : public Record
struct NPC
{
// Services
enum Services
@ -106,7 +106,7 @@ struct NPC : public Record
std::vector<Dest> mTransport;
AIPackageList mAiPackage;
std::string mName, mModel, mRace, mClass, mFaction, mScript;
std::string mId, mName, mModel, mRace, mClass, mFaction, mScript;
// body parts
std::string mHair, mHead;
@ -114,8 +114,6 @@ struct NPC : public Record
// Implementation moved to load_impl.cpp
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_NPC_; }
};
}
#endif

@ -73,7 +73,7 @@ namespace ESM {
* will be harder than reading it.
*/
struct LoadNPCC : public Record
struct LoadNPCC
{
void load(ESMReader &esm)
{
@ -82,8 +82,6 @@ struct LoadNPCC : public Record
void save(ESMWriter &esm)
{
}
int getName() { return REC_NPCC; }
};
}
#endif

@ -12,7 +12,7 @@ namespace ESM
/*
* Path grid.
*/
struct Pathgrid : public Record
struct Pathgrid
{
struct DATAstruct
{
@ -46,8 +46,6 @@ struct Pathgrid : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_PGRD; }
};
}
#endif

@ -12,7 +12,7 @@ namespace ESM
* Race definition
*/
struct Race : public Record
struct Race
{
struct SkillBonus
{
@ -66,8 +66,6 @@ struct Race : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_RACE; }
};
}

@ -14,7 +14,7 @@ namespace ESM
* Region data
*/
struct Region : public Record
struct Region
{
#pragma pack(push)
#pragma pack(1)
@ -46,8 +46,6 @@ struct Region : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_REGN; }
};
}
#endif

@ -14,7 +14,7 @@ namespace ESM
* Script definitions
*/
class Script : public Record
class Script
{
public:
struct SCHDstruct
@ -55,8 +55,6 @@ public:
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_SCPT; }
};
}
#endif

@ -15,7 +15,7 @@ namespace ESM {
*
*/
struct Skill : public Record
struct Skill
{
struct SKDTstruct
{
@ -71,8 +71,6 @@ struct Skill : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_SKIL; }
};
}
#endif

@ -12,7 +12,7 @@ namespace ESM
* Sound generator. This describes the sounds a creature make.
*/
struct SoundGenerator : public Record
struct SoundGenerator
{
enum Type
{
@ -33,8 +33,6 @@ struct SoundGenerator : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_SNDG; }
};
}
#endif

@ -13,15 +13,13 @@ struct SOUNstruct
unsigned char mVolume, mMinRange, mMaxRange;
};
struct Sound : public Record
struct Sound
{
SOUNstruct mData;
std::string mSound;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_SOUN; }
};
}
#endif

@ -9,7 +9,7 @@
namespace ESM
{
struct Spell : public Record
struct Spell
{
enum SpellType
{
@ -41,8 +41,6 @@ struct Spell : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_SPEL; }
};
}
#endif

@ -16,7 +16,7 @@ namespace ESM
reference.
*/
struct StartScript : public Record
struct StartScript
{
std::string mData;
std::string mScript;
@ -24,8 +24,6 @@ struct StartScript : public Record
// Load a record and add it to the list
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_SSCR; }
};
}

@ -19,14 +19,12 @@ namespace ESM {
* you decode the CELL blocks, if you want to test this hypothesis.
*/
struct Static : public Record
struct Static
{
std::string mModel;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_STAT; }
};
}
#endif

@ -12,7 +12,7 @@ namespace ESM
* Weapon definition
*/
struct Weapon : public Record
struct Weapon
{
enum Type
{
@ -59,8 +59,6 @@ struct Weapon : public Record
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_WEAP; }
};
}
#endif

@ -173,7 +173,7 @@ namespace ESMS
void load(ESMReader &esm, const std::string &id)
{
std::string id2 = toLower (id);
list[id2].setId(id2);
list[id2].mId = id2;
list[id2].load(esm);
}
@ -226,7 +226,7 @@ namespace ESMS
std::string id2 = toLower (id);
X& ref = list[id2];
ref.setId(id);
ref.mId = id;
ref.load(esm);
}
@ -293,7 +293,7 @@ namespace ESMS
{
LandTexture lt;
lt.load(esm);
lt.setId(id);
lt.mId = id;
// Make sure we have room for the structure
if(lt.mIndex + 1 > (int)ltex.size())

Loading…
Cancel
Save