Conflicts:

apps/opencs/view/render/pagedworldspacewidget.cpp
loadfix
cc9cii 10 years ago
parent 3e5027abbb
commit 809b8c6d5b

@ -1,139 +0,0 @@
Adam Hogan <comrade@comrade-desktop.(none)>
Aleksandar Jovanov <ajovanov93@yahoo.com>
Alexander Olofsson <ace@haxalot.com>
Alex McKibben <mckibbenta@gmail.com>
Alex "rainChu" Haddad <alx1213@gmail.com>
Ardekantur <greystone@ardekantur.com>
Armin Preiml <b.nutzer@gmail.com>
Artem Kotsynyak <greye@carceri>
Arthur Moore <arthur@Behemoth>
Arthur Moore <Arthur.Moore.git@cd-net.net>
athile <athile@athile.net>
athile <athile.g@gmail.com>
Stefan Galowicz <bogglez@the.mind>
Bret Curtis <psi29a@gmail.com>
Britt Mathis <britt.mathis@gmail.com>
Sandy Carter <bwrsandman@gmail.com>
Sandy Carter <mr.sandy.carter@gmail.com>
Carl Maxwell <carl.maxwell@gmail.com>
cc9cii <cc9c@iinet.net.au>
Cory F. Cohen <cfcohen@verizon.net>
Chris Robinson <chris.kcat@gmail.com>
Cris Mihalache <mirceam94@hotmail.com>
darkf <lw9k123@gmail.com>
Diggory Hardy <diggory.hardy@gmail.com>
Thomas Luppi <ThomasLuppi@gmail.com>
Thomas Luppi <tluppi@thomas-GE60.(none)>
Dmitriy 'Endorph' Shkurskiy <end0rph@hotmail.com>
Dmitry Marakasov <amdmi3@amdmi3.ru>
Douglas Diniz <dgdiniz@gmail.com>
Douglas Mencken <dougmencken@gmail.com>
Edmondo Tommasina <edmondo.tommasina@gmail.com>
Eduard Cot <eduard@eduard-iMac.(none)>
Eli2 <fabian@fabian-desktop.(none)>
Emanuel Guével <guevel.emanuel@gmail.com>
Leon Saunders <LeonDavidSaunders@gmail.com>
Fil Krynicki <filipkrynicki@gmail.com>
John Blomberg <johnblo@kth.se>
Gašper Sedej <gsedej@gmail.com>
Michał Bień <michal1.bien@gmail.com>
Joel Graff <monograff76@gmail.com>
Paul McElroy <pcm1123@gmail.com>
Artem Kotsynyak <greye@carceri>
Artem Kotsynyak <greye@null.net>
gugus <gus_512@hotmail.com>
guidoj <guido@thuisbasis.net>
gus <gus_512@hotmail.com>
Hallfaer Tuilinn <gijsbertth@gmail.com>
Julian Ospald <julian.ospald@googlemail.com>
Jacob Essex <jacob@jacobessex.com>
Jan Borsodi <jborsodi@gmail.com>
Jan-Peter Nilsson <peppe@pappkartong.se>
Jason Hooks <Hooks@.(none)>
Jason Hooks <jason@Jason-ThinkPad-R61.(none)>
Jason Hooks <jhooks1@mix.wvu.edu>
Jeffrey Haines <jeffhaines@me.com>
Jeffrey Haines <jib-y@users.noreply.github.com>
Jordan Ayers <jordan.ayers@gmail.com>
Jordan Milne <jordan.milne@saynotolinux.com>
Josua Grawitter <josh@greyage.org>
Julien Voisin <pouicpouicpouic@gmail.com>
Karl-Felix Glatzer <karl.glatzer@gmx.de>
Chris Robinson <chris.kcat@gmail.com>
Kevin Poitra <pupkev@yahoo.com>
Roman Proskuryakov <humbug@deeptown.org>
Lars Söderberg <lazze_1983@hotmail.com>
lazydev <lazydev@homecomp>
lazydev <lazydev@nomail>
Lukasz Gromanowski <lgromanowski@gmail.com>
Marc Bouvier <marcrbouvier@gmail.com>
Marcin Hulist <Gohan1989@gmail.com>
Marc Zinnschlag <marc@zpages.de>
Marek Kochanowicz <herr@mikrus.pl>
Marek Kochanowicz <marek@localhost.localdomain>
Marek Kochanowicz <sirherrbatka@gmail.com>
Mark Siewert <mark.siewert@t-online.de>
Mark Siewert <ms@cerebra.localdomain>
megaton <9megaton6@gmail.com>
Michael Mc Donnell <michael@mcdonnell.dk>
Michael Papageorgiou <werdanith@yahoo.gr>
Michal Sciubidlo <michal.sciubidlo@gmail.com>
Michał Ściubidło <michal.sciubidlo@gmail.com>
Nathan Jeffords <blunted2night@gmail.com>
Nicolay Korslund <korslund@gmail.com>
Nicolay Korslund <nicolayk@met.no>
Nikolay Kasyanov <corrmage@gmail.com>
pchan3 <chantlerpeter@gmail.com>
Pieter van der Kloet <pvdkloet@gmail.com>
Mateusz Kołaczek <mateusz.kolaczek@gmail.com>
Bret Curtis <psi29a@gmail.com>
Pieter van der Kloet <pvdkloet@gmail.com>
Rohit Nirmal <rohitnirmal9@gmail.com>
Roman Melnik <kromgart@gmail.com>
Radu-Marius Popovici <rpopovici@github.com>
Sandy Carter <bwrsandman@gmail.com>
Scott Howard <showard314@gmail.com>
Jannik Heller <scrawl@baseoftrash.de>
Jannik Heller <scrawl@scrawl-laptop.(none)>
Sebastian Wick <sebastian@sebastianwick.net>
Sebastian Wick <wick.sebastian@gmail.com>
Sergey Shambir <sergey.shambir.auto@gmail.com>
sergoz <parapvr@yandex.ru>
Chris Boyce <slothlife@users.noreply.github.com>
Star-Demon <starsickle@yahoo.com>
Sylvain Thesnieres <garvek@gmail.com>
Thomas Luppi <digrules@gmail.com>
Thomas Luppi <tluppi@thomas-GE60.(none)>
Thoronador <thoronador@users.sourceforge.net>
TomKoenderink <tom_koenderink-github@omniadicta.net>
Tom Mason <wheybags@wheybags.com>
Torben Carrington <torbenlcarrington@Gmail.com>
Vincent Heuken <vincent@vincentheuken.com>
Manuel Edelmann <edelmann.manuel@gmail.com>
Manuel Edelmann <vorenon@hotmail.com>
Alexander Nadeau <wareya@gmail.com>
Michael Hogan <mr.michaelhogan@gmail.com>
Jacob Essex <github@JacobEssex.com>
Yuri Krupenin <yuri.krupenin@gmail.com>
Bret Curtis <noone@your.box>
sirherrbatka <herr@localhost.localdomain>
sirherrbatka <sirherrbatka@myopera.com>
sergei <sergei@ubuntu.(none)>
riothamus <digimars@gmail.com>
nobrakal <nobrakal@gmail.com>
nkorslund <nkorslund@ea6a568a-9f4f-0410-981a-c910a81bb256>
mrcheko <cheko@sevas.ua>
Miroslav Puda <pakanek@gmail.com>
MiroslavR <miroslavr256@gmail.com>
mckibbenta <mckibbenta@gmail.com>
jeaye <jeaye@arrownext.com>
eroen <eroen@falcon.eroen.eu>
eroen <eroen@occam.eroen.eu>
dreamer-dead <dreamer.dead@gmail.com>
crysthala <crystalsoulslayer@gmail.com>
Berulacks <beru@eml.cc>
Axujen <axujen@gmail.com>
root <root@debian>
unknown <Hooks@.(none)>

@ -33,7 +33,11 @@ QString getAspect(int x, int y)
} }
Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, GraphicsSettings &graphicsSetting, QWidget *parent) Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, GraphicsSettings &graphicsSetting, QWidget *parent)
: mCfgMgr(cfg) : mOgre(NULL)
, mSelectedRenderSystem(NULL)
, mOpenGLRenderSystem(NULL)
, mDirect3DRenderSystem(NULL)
, mCfgMgr(cfg)
, mGraphicsSettings(graphicsSetting) , mGraphicsSettings(graphicsSetting)
, QWidget(parent) , QWidget(parent)
{ {

@ -26,11 +26,12 @@ opencs_units (model/world
opencs_units_noqt (model/world opencs_units_noqt (model/world
universalid record commands columnbase scriptcontext cell refidcollection universalid record commands columnbase scriptcontext cell refidcollection
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope landtexture land refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope
pathgrid landtexture land
) )
opencs_hdrs_noqt (model/world opencs_hdrs_noqt (model/world
columnimp idcollection collection info columnimp idcollection collection info subcellcollection
) )

@ -21,7 +21,7 @@
CS::Editor::Editor (OgreInit::OgreInit& ogreInit) CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
: mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), mViewManager (mDocumentManager), : mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), mViewManager (mDocumentManager),
mIpcServerName ("org.openmw.OpenCS") mIpcServerName ("org.openmw.OpenCS"), mServer(NULL), mClientSocket(NULL)
{ {
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig(); std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig();

@ -2023,6 +2023,7 @@ void CSMDoc::Document::addOptionalGmsts()
{ {
ESM::GameSetting gmst; ESM::GameSetting gmst;
gmst.mId = sFloats[i]; gmst.mId = sFloats[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_Float); gmst.mValue.setType (ESM::VT_Float);
addOptionalGmst (gmst); addOptionalGmst (gmst);
} }
@ -2031,6 +2032,7 @@ void CSMDoc::Document::addOptionalGmsts()
{ {
ESM::GameSetting gmst; ESM::GameSetting gmst;
gmst.mId = sIntegers[i]; gmst.mId = sIntegers[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_Int); gmst.mValue.setType (ESM::VT_Int);
addOptionalGmst (gmst); addOptionalGmst (gmst);
} }
@ -2039,6 +2041,7 @@ void CSMDoc::Document::addOptionalGmsts()
{ {
ESM::GameSetting gmst; ESM::GameSetting gmst;
gmst.mId = sStrings[i]; gmst.mId = sStrings[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_String); gmst.mValue.setType (ESM::VT_String);
gmst.mValue.setString ("<no text>"); gmst.mValue.setString ("<no text>");
addOptionalGmst (gmst); addOptionalGmst (gmst);
@ -2059,6 +2062,7 @@ void CSMDoc::Document::addOptionalGlobals()
{ {
ESM::Global global; ESM::Global global;
global.mId = sGlobals[i]; global.mId = sGlobals[i];
global.blank();
global.mValue.setType (ESM::VT_Long); global.mValue.setType (ESM::VT_Long);
if (i==0) if (i==0)
@ -2068,6 +2072,19 @@ void CSMDoc::Document::addOptionalGlobals()
} }
} }
void CSMDoc::Document::addOptionalMagicEffects()
{
for (int i=ESM::MagicEffect::SummonFabricant; i<=ESM::MagicEffect::SummonCreature05; ++i)
{
ESM::MagicEffect effect;
effect.mIndex = i;
effect.mId = ESM::MagicEffect::indexToId (i);
effect.blank();
addOptionalMagicEffect (effect);
}
}
void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst) void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
{ {
if (getData().getGmsts().searchId (gmst.mId)==-1) if (getData().getGmsts().searchId (gmst.mId)==-1)
@ -2090,6 +2107,17 @@ void CSMDoc::Document::addOptionalGlobal (const ESM::Global& global)
} }
} }
void CSMDoc::Document::addOptionalMagicEffect (const ESM::MagicEffect& magicEffect)
{
if (getData().getMagicEffects().searchId (magicEffect.mId)==-1)
{
CSMWorld::Record<ESM::MagicEffect> record;
record.mBase = magicEffect;
record.mState = CSMWorld::RecordBase::State_BaseOnly;
getData().getMagicEffects().appendRecord (record);
}
}
void CSMDoc::Document::createBase() void CSMDoc::Document::createBase()
{ {
static const char *sGlobals[] = static const char *sGlobals[] =
@ -2201,6 +2229,18 @@ void CSMDoc::Document::createBase()
getData().getTopics().add (record); getData().getTopics().add (record);
} }
for (int i=0; i<ESM::MagicEffect::Length; ++i)
{
ESM::MagicEffect record;
record.mIndex = i;
record.mId = ESM::MagicEffect::indexToId (i);
record.blank();
getData().getMagicEffects().add (record);
}
} }
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
@ -2248,6 +2288,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
addOptionalGmsts(); addOptionalGmsts();
addOptionalGlobals(); addOptionalGlobals();
addOptionalMagicEffects();
connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool))); connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool)));

@ -26,6 +26,7 @@ namespace ESM
{ {
struct GameSetting; struct GameSetting;
struct Global; struct Global;
struct MagicEffect;
} }
namespace Files namespace Files
@ -73,10 +74,14 @@ namespace CSMDoc
void addOptionalGlobals(); void addOptionalGlobals();
void addOptionalMagicEffects();
void addOptionalGmst (const ESM::GameSetting& gmst); void addOptionalGmst (const ESM::GameSetting& gmst);
void addOptionalGlobal (const ESM::Global& global); void addOptionalGlobal (const ESM::Global& global);
void addOptionalMagicEffect (const ESM::MagicEffect& effect);
public: public:
Document (const Files::ConfigurationManager& configuration, Document (const Files::ConfigurationManager& configuration,

@ -27,7 +27,9 @@ void CSMDoc::Operation::prepareStages()
} }
CSMDoc::Operation::Operation (int type, bool ordered, bool finalAlways) CSMDoc::Operation::Operation (int type, bool ordered, bool finalAlways)
: mType (type), mOrdered (ordered), mFinalAlways (finalAlways) : mType (type), mStages(std::vector<std::pair<Stage *, int> >()), mCurrentStage(mStages.begin()),
mCurrentStep(0), mCurrentStepTotal(0), mTotalSteps(0), mOrdered (ordered),
mFinalAlways (finalAlways), mError(false)
{ {
connect (this, SIGNAL (finished()), this, SLOT (operationDone())); connect (this, SIGNAL (finished()), this, SLOT (operationDone()));
} }
@ -120,4 +122,4 @@ void CSMDoc::Operation::executeStage()
void CSMDoc::Operation::operationDone() void CSMDoc::Operation::operationDone()
{ {
emit done (mType, mError); emit done (mType, mError);
} }

@ -72,6 +72,12 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BodyPart> > appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BodyPart> >
(mDocument.getData().getBodyParts(), mState)); (mDocument.getData().getBodyParts(), mState));
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::SoundGenerator> >
(mDocument.getData().getSoundGens(), mState));
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::MagicEffect> >
(mDocument.getData().getMagicEffects(), mState));
appendStage (new WriteDialogueCollectionStage (mDocument, mState, false)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, false));
appendStage (new WriteDialogueCollectionStage (mDocument, mState, true)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, true));
@ -82,6 +88,8 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
appendStage (new WriteCellCollectionStage (mDocument, mState)); appendStage (new WriteCellCollectionStage (mDocument, mState));
appendStage (new WritePathgridCollectionStage (mDocument, mState));
// close file and clean up // close file and clean up
appendStage (new CloseSaveStage (mState)); appendStage (new CloseSaveStage (mState));

@ -311,6 +311,48 @@ void CSMDoc::WriteCellCollectionStage::perform (int stage, Messages& messages)
} }
CSMDoc::WritePathgridCollectionStage::WritePathgridCollectionStage (Document& document,
SavingState& state)
: mDocument (document), mState (state)
{}
int CSMDoc::WritePathgridCollectionStage::setup()
{
return mDocument.getData().getPathgrids().getSize();
}
void CSMDoc::WritePathgridCollectionStage::perform (int stage, Messages& messages)
{
const CSMWorld::Record<CSMWorld::Pathgrid>& pathgrid =
mDocument.getData().getPathgrids().getRecord (stage);
if (pathgrid.mState==CSMWorld::RecordBase::State_Modified ||
pathgrid.mState==CSMWorld::RecordBase::State_ModifiedOnly)
{
CSMWorld::Pathgrid record = pathgrid.get();
if (record.mId.substr (0, 1)=="#")
{
std::istringstream stream (record.mId.c_str());
char ignore;
stream >> ignore >> record.mData.mX >> record.mData.mY;
}
else
record.mCell = record.mId;
mState.getWriter().startRecord (record.sRecordId);
record.save (mState.getWriter());
mState.getWriter().endRecord (record.sRecordId);
}
else if (pathgrid.mState==CSMWorld::RecordBase::State_Deleted)
{
/// \todo write record with delete flag
}
}
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state) CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
: mState (state) : mState (state)
{} {}

@ -183,6 +183,23 @@ namespace CSMDoc
///< Messages resulting from this stage will be appended to \a messages. ///< Messages resulting from this stage will be appended to \a messages.
}; };
class WritePathgridCollectionStage : public Stage
{
Document& mDocument;
SavingState& mState;
public:
WritePathgridCollectionStage (Document& document, SavingState& state);
virtual int setup();
///< \return number of steps
virtual void perform (int stage, Messages& messages);
///< Messages resulting from this stage will be appended to \a messages.
};
class CloseSaveStage : public Stage class CloseSaveStage : public Stage
{ {
SavingState& mState; SavingState& mState;

@ -101,7 +101,9 @@ namespace CSMWorld
Display_Texture, Display_Texture,
Display_Video, Display_Video,
Display_Colour, Display_Colour,
Display_ScriptLines // console context Display_ScriptLines, // console context
Display_SoundGeneratorType,
Display_School
}; };
int mColumnId; int mColumnId;
@ -125,8 +127,6 @@ namespace CSMWorld
template<typename ESXRecordT> template<typename ESXRecordT>
struct Column : public ColumnBase struct Column : public ColumnBase
{ {
int mFlags;
Column (int columnId, Display displayType, int flags = Flag_Table | Flag_Dialogue) Column (int columnId, Display displayType, int flags = Flag_Table | Flag_Dialogue)
: ColumnBase (columnId, displayType, flags) {} : ColumnBase (columnId, displayType, flags) {}

@ -1,7 +1,9 @@
#ifndef CSM_WOLRD_COLUMNIMP_H #ifndef CSM_WOLRD_COLUMNIMP_H
#define CSM_WOLRD_COLUMNIMP_H #define CSM_WOLRD_COLUMNIMP_H
#include <cassert>
#include <sstream> #include <sstream>
#include <stdexcept>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -1982,6 +1984,287 @@ namespace CSMWorld
return false; return false;
} }
}; };
template<typename ESXRecordT>
struct SoundColumn : public Column<ESXRecordT>
{
SoundColumn()
: Column<ESXRecordT> (Columns::ColumnId_Sound, ColumnBase::Display_Sound)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mSound.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mSound = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct CreatureColumn : public Column<ESXRecordT>
{
CreatureColumn()
: Column<ESXRecordT> (Columns::ColumnId_Creature, ColumnBase::Display_Creature)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mCreature.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mCreature = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct SoundGeneratorTypeColumn : public Column<ESXRecordT>
{
SoundGeneratorTypeColumn()
: Column<ESXRecordT> (Columns::ColumnId_SoundGeneratorType, ColumnBase::Display_SoundGeneratorType)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return static_cast<int> (record.get().mType);
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mType = data.toInt();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct BaseCostColumn : public Column<ESXRecordT>
{
BaseCostColumn() : Column<ESXRecordT> (Columns::ColumnId_BaseCost, ColumnBase::Display_Float) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return record.get().mData.mBaseCost;
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mData.mBaseCost = data.toFloat();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct SchoolColumn : public Column<ESXRecordT>
{
SchoolColumn()
: Column<ESXRecordT> (Columns::ColumnId_School, ColumnBase::Display_School)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return record.get().mData.mSchool;
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mData.mSchool = data.toInt();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct EffectTextureColumn : public Column<ESXRecordT>
{
EffectTextureColumn (Columns::ColumnId columnId)
: Column<ESXRecordT> (columnId, ColumnBase::Display_Texture)
{
assert (this->mColumnId==Columns::ColumnId_Icon ||
this->mColumnId==Columns::ColumnId_Particle);
}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (
(this->mColumnId==Columns::ColumnId_Icon ?
record.get().mIcon : record.get().mParticle).c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
(this->mColumnId==Columns::ColumnId_Icon ?
record2.mIcon : record2.mParticle)
= data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct EffectObjectColumn : public Column<ESXRecordT>
{
EffectObjectColumn (Columns::ColumnId columnId)
: Column<ESXRecordT> (columnId, columnId==Columns::ColumnId_BoltObject ? ColumnBase::Display_Weapon : ColumnBase::Display_Static)
{
assert (this->mColumnId==Columns::ColumnId_CastingObject ||
this->mColumnId==Columns::ColumnId_HitObject ||
this->mColumnId==Columns::ColumnId_AreaObject ||
this->mColumnId==Columns::ColumnId_BoltObject);
}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
const std::string *string = 0;
switch (this->mColumnId)
{
case Columns::ColumnId_CastingObject: string = &record.get().mCasting; break;
case Columns::ColumnId_HitObject: string = &record.get().mHit; break;
case Columns::ColumnId_AreaObject: string = &record.get().mArea; break;
case Columns::ColumnId_BoltObject: string = &record.get().mBolt; break;
}
if (!string)
throw std::logic_error ("Unsupported column ID");
return QString::fromUtf8 (string->c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
std::string *string = 0;
ESXRecordT record2 = record.get();
switch (this->mColumnId)
{
case Columns::ColumnId_CastingObject: string = &record2.mCasting; break;
case Columns::ColumnId_HitObject: string = &record2.mHit; break;
case Columns::ColumnId_AreaObject: string = &record2.mArea; break;
case Columns::ColumnId_BoltObject: string = &record2.mBolt; break;
}
if (!string)
throw std::logic_error ("Unsupported column ID");
*string = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct EffectSoundColumn : public Column<ESXRecordT>
{
EffectSoundColumn (Columns::ColumnId columnId)
: Column<ESXRecordT> (columnId, ColumnBase::Display_Sound)
{
assert (this->mColumnId==Columns::ColumnId_CastingSound ||
this->mColumnId==Columns::ColumnId_HitSound ||
this->mColumnId==Columns::ColumnId_AreaSound ||
this->mColumnId==Columns::ColumnId_BoltSound);
}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
const std::string *string = 0;
switch (this->mColumnId)
{
case Columns::ColumnId_CastingSound: string = &record.get().mCastSound; break;
case Columns::ColumnId_HitSound: string = &record.get().mHitSound; break;
case Columns::ColumnId_AreaSound: string = &record.get().mAreaSound; break;
case Columns::ColumnId_BoltSound: string = &record.get().mBoltSound; break;
}
if (!string)
throw std::logic_error ("Unsupported column ID");
return QString::fromUtf8 (string->c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
std::string *string = 0;
ESXRecordT record2 = record.get();
switch (this->mColumnId)
{
case Columns::ColumnId_CastingSound: string = &record2.mCastSound; break;
case Columns::ColumnId_HitSound: string = &record2.mHitSound; break;
case Columns::ColumnId_AreaSound: string = &record2.mAreaSound; break;
case Columns::ColumnId_BoltSound: string = &record2.mBoltSound; break;
}
if (!string)
throw std::logic_error ("Unsupported column ID");
*string = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
} }
#endif #endif

@ -186,6 +186,21 @@ namespace CSMWorld
{ ColumnId_GlobalProfile, "Global Profile" }, { ColumnId_GlobalProfile, "Global Profile" },
{ ColumnId_RefNumCounter, "RefNum Counter" }, { ColumnId_RefNumCounter, "RefNum Counter" },
{ ColumnId_RefNum, "RefNum" }, { ColumnId_RefNum, "RefNum" },
{ ColumnId_Creature, "Creature" },
{ ColumnId_SoundGeneratorType, "Sound Generator Type" },
{ ColumnId_AllowSpellmaking, "Allow Spellmaking" },
{ ColumnId_AllowEnchanting, "Allow Enchanting" },
{ ColumnId_BaseCost, "Base Cost" },
{ ColumnId_School, "School" },
{ ColumnId_Particle, "Particle" },
{ ColumnId_CastingObject, "Casting Object" },
{ ColumnId_HitObject, "Hit Object" },
{ ColumnId_AreaObject, "Area Object" },
{ ColumnId_BoltObject, "Bolt Object" },
{ ColumnId_CastingSound, "Casting Sound" },
{ ColumnId_HitSound, "Hit Sound" },
{ ColumnId_AreaSound, "Area Sound" },
{ ColumnId_BoltSound, "Bolt Sound" },
{ ColumnId_UseValue1, "Use value 1" }, { ColumnId_UseValue1, "Use value 1" },
{ ColumnId_UseValue2, "Use value 2" }, { ColumnId_UseValue2, "Use value 2" },
@ -327,6 +342,17 @@ namespace
"Skin", "Clothing", "Armour", 0 "Skin", "Clothing", "Armour", 0
}; };
static const char *sSoundGeneratorType[] =
{
"Left Foot", "Right Foot", "Swim Left", "Swim Right", "Moan", "Roar", "Scream",
"Land", 0
};
static const char *sSchools[] =
{
"Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration", 0
};
const char **getEnumNames (CSMWorld::Columns::ColumnId column) const char **getEnumNames (CSMWorld::Columns::ColumnId column)
{ {
switch (column) switch (column)
@ -347,6 +373,8 @@ namespace
case CSMWorld::Columns::ColumnId_EnchantmentType: return sEnchantmentTypes; case CSMWorld::Columns::ColumnId_EnchantmentType: return sEnchantmentTypes;
case CSMWorld::Columns::ColumnId_BodyPartType: return sBodyPartTypes; case CSMWorld::Columns::ColumnId_BodyPartType: return sBodyPartTypes;
case CSMWorld::Columns::ColumnId_MeshType: return sMeshTypes; case CSMWorld::Columns::ColumnId_MeshType: return sMeshTypes;
case CSMWorld::Columns::ColumnId_SoundGeneratorType: return sSoundGeneratorType;
case CSMWorld::Columns::ColumnId_School: return sSchools;
default: return 0; default: return 0;
} }

@ -179,7 +179,21 @@ namespace CSMWorld
ColumnId_GlobalProfile = 167, ColumnId_GlobalProfile = 167,
ColumnId_RefNumCounter = 168, ColumnId_RefNumCounter = 168,
ColumnId_RefNum = 169, ColumnId_RefNum = 169,
ColumnId_Creature = 170,
ColumnId_SoundGeneratorType = 171,
ColumnId_AllowSpellmaking = 172,
ColumnId_AllowEnchanting = 173,
ColumnId_BaseCost = 174,
ColumnId_School = 175,
ColumnId_Particle = 176,
ColumnId_CastingObject = 177,
ColumnId_HitObject = 178,
ColumnId_AreaObject = 179,
ColumnId_BoltObject = 180,
ColumnId_CastingSound = 177,
ColumnId_HitSound = 178,
ColumnId_AreaSound = 179,
ColumnId_BoltSound = 180,
// Allocated to a separate value range, so we don't get a collision should we ever need // Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of use values. // to extend the number of use values.
ColumnId_UseValue1 = 0x10000, ColumnId_UseValue1 = 0x10000,

@ -59,8 +59,8 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
} }
CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager) CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager)
: mEncoder (encoding), mRefs (mCells), mResourcesManager (resourcesManager), mReader (0), : mEncoder (encoding), mPathgrids (mCells), mRefs (mCells),
mDialogue (0) mResourcesManager (resourcesManager), mReader (0), mDialogue (0)
{ {
mGlobals.addColumn (new StringIdColumn<ESM::Global>); mGlobals.addColumn (new StringIdColumn<ESM::Global>);
mGlobals.addColumn (new RecordStateColumn<ESM::Global>); mGlobals.addColumn (new RecordStateColumn<ESM::Global>);
@ -71,7 +71,6 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mGmsts.addColumn (new StringIdColumn<ESM::GameSetting>); mGmsts.addColumn (new StringIdColumn<ESM::GameSetting>);
mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>); mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>);
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst)); mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting> (ColumnBase::Display_GmstVarType)); mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting> (ColumnBase::Display_GmstVarType));
mGmsts.addColumn (new VarValueColumn<ESM::GameSetting>); mGmsts.addColumn (new VarValueColumn<ESM::GameSetting>);
@ -221,6 +220,40 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mBodyParts.addColumn (new ModelColumn<ESM::BodyPart>); mBodyParts.addColumn (new ModelColumn<ESM::BodyPart>);
mBodyParts.addColumn (new RaceColumn<ESM::BodyPart>); mBodyParts.addColumn (new RaceColumn<ESM::BodyPart>);
mSoundGens.addColumn (new StringIdColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new RecordStateColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new FixedRecordTypeColumn<ESM::SoundGenerator> (UniversalId::Type_SoundGen));
mSoundGens.addColumn (new CreatureColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new SoundColumn<ESM::SoundGenerator>);
mSoundGens.addColumn (new SoundGeneratorTypeColumn<ESM::SoundGenerator>);
mMagicEffects.addColumn (new StringIdColumn<ESM::MagicEffect>);
mMagicEffects.addColumn (new RecordStateColumn<ESM::MagicEffect>);
mMagicEffects.addColumn (new FixedRecordTypeColumn<ESM::MagicEffect> (UniversalId::Type_MagicEffect));
mMagicEffects.addColumn (new SchoolColumn<ESM::MagicEffect>);
mMagicEffects.addColumn (new BaseCostColumn<ESM::MagicEffect>);
mMagicEffects.addColumn (new EffectTextureColumn<ESM::MagicEffect> (Columns::ColumnId_Icon));
mMagicEffects.addColumn (new EffectTextureColumn<ESM::MagicEffect> (Columns::ColumnId_Particle));
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_CastingObject));
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_HitObject));
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_AreaObject));
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_BoltObject));
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_CastingSound));
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_HitSound));
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_AreaSound));
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_BoltSound));
mMagicEffects.addColumn (new FlagColumn<ESM::MagicEffect> (
Columns::ColumnId_AllowSpellmaking, ESM::MagicEffect::AllowSpellmaking));
mMagicEffects.addColumn (new FlagColumn<ESM::MagicEffect> (
Columns::ColumnId_AllowEnchanting, ESM::MagicEffect::AllowEnchanting));
mMagicEffects.addColumn (new FlagColumn<ESM::MagicEffect> (
Columns::ColumnId_NegativeLight, ESM::MagicEffect::NegativeLight));
mMagicEffects.addColumn (new DescriptionColumn<ESM::MagicEffect>);
mPathgrids.addColumn (new StringIdColumn<Pathgrid>);
mPathgrids.addColumn (new RecordStateColumn<Pathgrid>);
mPathgrids.addColumn (new FixedRecordTypeColumn<Pathgrid> (UniversalId::Type_Pathgrid));
mRefs.addColumn (new StringIdColumn<CellRef> (true)); mRefs.addColumn (new StringIdColumn<CellRef> (true));
mRefs.addColumn (new RecordStateColumn<CellRef>); mRefs.addColumn (new RecordStateColumn<CellRef>);
mRefs.addColumn (new FixedRecordTypeColumn<CellRef> (UniversalId::Type_Reference)); mRefs.addColumn (new FixedRecordTypeColumn<CellRef> (UniversalId::Type_Reference));
@ -291,6 +324,9 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
addModel (new IdTable (&mCells, IdTable::Feature_ViewId), UniversalId::Type_Cell); addModel (new IdTable (&mCells, IdTable::Feature_ViewId), UniversalId::Type_Cell);
addModel (new IdTable (&mEnchantments), UniversalId::Type_Enchantment); addModel (new IdTable (&mEnchantments), UniversalId::Type_Enchantment);
addModel (new IdTable (&mBodyParts), UniversalId::Type_BodyPart); addModel (new IdTable (&mBodyParts), UniversalId::Type_BodyPart);
addModel (new IdTable (&mSoundGens), UniversalId::Type_SoundGen);
addModel (new IdTable (&mMagicEffects), UniversalId::Type_MagicEffect);
addModel (new IdTable (&mPathgrids), UniversalId::Type_Pathgrid);
addModel (new IdTable (&mReferenceables, IdTable::Feature_Preview), addModel (new IdTable (&mReferenceables, IdTable::Feature_Preview),
UniversalId::Type_Referenceable); UniversalId::Type_Referenceable);
addModel (new IdTable (&mRefs, IdTable::Feature_ViewCell | IdTable::Feature_Preview), UniversalId::Type_Reference); addModel (new IdTable (&mRefs, IdTable::Feature_ViewCell | IdTable::Feature_Preview), UniversalId::Type_Reference);
@ -549,6 +585,36 @@ const CSMWorld::IdCollection<CSMWorld::LandTexture>& CSMWorld::Data::getLandText
return mLandTextures; return mLandTextures;
} }
const CSMWorld::IdCollection<ESM::SoundGenerator>& CSMWorld::Data::getSoundGens() const
{
return mSoundGens;
}
CSMWorld::IdCollection<ESM::SoundGenerator>& CSMWorld::Data::getSoundGens()
{
return mSoundGens;
}
const CSMWorld::IdCollection<ESM::MagicEffect>& CSMWorld::Data::getMagicEffects() const
{
return mMagicEffects;
}
CSMWorld::IdCollection<ESM::MagicEffect>& CSMWorld::Data::getMagicEffects()
{
return mMagicEffects;
}
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& CSMWorld::Data::getPathgrids() const
{
return mPathgrids;
}
CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& CSMWorld::Data::getPathgrids()
{
return mPathgrids;
}
const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const
{ {
return mResourcesManager.get (id.getType()); return mResourcesManager.get (id.getType());
@ -641,6 +707,9 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Stage::Messages& messages)
case ESM::REC_SPEL: mSpells.load (*mReader, mBase); break; case ESM::REC_SPEL: mSpells.load (*mReader, mBase); break;
case ESM::REC_ENCH: mEnchantments.load (*mReader, mBase); break; case ESM::REC_ENCH: mEnchantments.load (*mReader, mBase); break;
case ESM::REC_BODY: mBodyParts.load (*mReader, mBase); break; case ESM::REC_BODY: mBodyParts.load (*mReader, mBase); break;
case ESM::REC_SNDG: mSoundGens.load (*mReader, mBase); break;
case ESM::REC_MGEF: mMagicEffects.load (*mReader, mBase); break;
case ESM::REC_PGRD: mPathgrids.load (*mReader, mBase); break;
case ESM::REC_LTEX: mLandTextures.load (*mReader, mBase); break; case ESM::REC_LTEX: mLandTextures.load (*mReader, mBase); break;
case ESM::REC_LAND: mLand.load(*mReader, mBase); break; case ESM::REC_LAND: mLand.load(*mReader, mBase); break;
@ -794,9 +863,9 @@ bool CSMWorld::Data::hasId (const std::string& id) const
getCells().searchId (id)!=-1 || getCells().searchId (id)!=-1 ||
getEnchantments().searchId (id)!=-1 || getEnchantments().searchId (id)!=-1 ||
getBodyParts().searchId (id)!=-1 || getBodyParts().searchId (id)!=-1 ||
getReferenceables().searchId (id)!=-1 || getSoundGens().searchId (id)!=-1 ||
getLand().searchId (id) != -1 || getMagicEffects().searchId (id)!=-1 ||
getLandTextures().searchId (id) != -1; getReferenceables().searchId (id)!=-1;
} }
int CSMWorld::Data::count (RecordBase::State state) const int CSMWorld::Data::count (RecordBase::State state) const
@ -816,9 +885,12 @@ int CSMWorld::Data::count (RecordBase::State state) const
count (state, mCells) + count (state, mCells) +
count (state, mEnchantments) + count (state, mEnchantments) +
count (state, mBodyParts) + count (state, mBodyParts) +
count (state, mReferenceables) +
count (state, mLand) + count (state, mLand) +
count (state, mLandTextures); count (state, mLandTextures) +
count (state, mSoundGens) +
count (state, mMagicEffects) +
count (state, mReferenceables) +
count (state, mPathgrids);
} }
void CSMWorld::Data::setDescription (const std::string& description) void CSMWorld::Data::setDescription (const std::string& description)
@ -860,9 +932,9 @@ std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
appendIds (ids, mCells, listDeleted); appendIds (ids, mCells, listDeleted);
appendIds (ids, mEnchantments, listDeleted); appendIds (ids, mEnchantments, listDeleted);
appendIds (ids, mBodyParts, listDeleted); appendIds (ids, mBodyParts, listDeleted);
appendIds (ids, mSoundGens, listDeleted);
appendIds (ids, mMagicEffects, listDeleted);
appendIds (ids, mReferenceables, listDeleted); appendIds (ids, mReferenceables, listDeleted);
appendIds (ids, mLand, listDeleted);
appendIds (ids, mLandTextures, listDeleted);
std::sort (ids.begin(), ids.end()); std::sort (ids.begin(), ids.end());

@ -23,6 +23,8 @@
#include <components/esm/loaddial.hpp> #include <components/esm/loaddial.hpp>
#include <components/esm/loadench.hpp> #include <components/esm/loadench.hpp>
#include <components/esm/loadbody.hpp> #include <components/esm/loadbody.hpp>
#include <components/esm/loadsndg.hpp>
#include <components/esm/loadmgef.hpp>
#include <components/esm/debugprofile.hpp> #include <components/esm/debugprofile.hpp>
#include <components/esm/filter.hpp> #include <components/esm/filter.hpp>
@ -38,6 +40,8 @@
#include "refidcollection.hpp" #include "refidcollection.hpp"
#include "refcollection.hpp" #include "refcollection.hpp"
#include "infocollection.hpp" #include "infocollection.hpp"
#include "pathgrid.hpp"
#include "subcellcollection.hpp"
class QAbstractItemModel; class QAbstractItemModel;
@ -72,7 +76,10 @@ namespace CSMWorld
IdCollection<ESM::Dialogue> mJournals; IdCollection<ESM::Dialogue> mJournals;
IdCollection<ESM::Enchantment> mEnchantments; IdCollection<ESM::Enchantment> mEnchantments;
IdCollection<ESM::BodyPart> mBodyParts; IdCollection<ESM::BodyPart> mBodyParts;
IdCollection<ESM::MagicEffect> mMagicEffects;
SubCellCollection<Pathgrid> mPathgrids;
IdCollection<ESM::DebugProfile> mDebugProfiles; IdCollection<ESM::DebugProfile> mDebugProfiles;
IdCollection<ESM::SoundGenerator> mSoundGens;
InfoCollection mTopicInfos; InfoCollection mTopicInfos;
InfoCollection mJournalInfos; InfoCollection mJournalInfos;
IdCollection<Cell> mCells; IdCollection<Cell> mCells;
@ -205,6 +212,18 @@ namespace CSMWorld
const IdCollection<CSMWorld::LandTexture>& getLandTextures() const; const IdCollection<CSMWorld::LandTexture>& getLandTextures() const;
const IdCollection<ESM::SoundGenerator>& getSoundGens() const;
IdCollection<ESM::SoundGenerator>& getSoundGens();
const IdCollection<ESM::MagicEffect>& getMagicEffects() const;
IdCollection<ESM::MagicEffect>& getMagicEffects();
const SubCellCollection<Pathgrid>& getPathgrids() const;
SubCellCollection<Pathgrid>& getPathgrids();
/// Throws an exception, if \a id does not match a resources list. /// Throws an exception, if \a id does not match a resources list.
const Resources& getResources (const UniversalId& id) const; const Resources& getResources (const UniversalId& id) const;

@ -11,6 +11,8 @@ namespace CSMWorld
template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT> > template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT> >
class IdCollection : public Collection<ESXRecordT, IdAccessorT> class IdCollection : public Collection<ESXRecordT, IdAccessorT>
{ {
virtual void loadRecord (ESXRecordT& record, ESM::ESMReader& reader);
public: public:
void load (ESM::ESMReader& reader, bool base); void load (ESM::ESMReader& reader, bool base);
@ -26,6 +28,13 @@ namespace CSMWorld
/// \return Has the ID been deleted? /// \return Has the ID been deleted?
}; };
template<typename ESXRecordT, typename IdAccessorT>
void IdCollection<ESXRecordT, IdAccessorT>::loadRecord (ESXRecordT& record,
ESM::ESMReader& reader)
{
record.load (reader);
}
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
void IdCollection<ESXRecordT, IdAccessorT>::load (ESM::ESMReader& reader, bool base) void IdCollection<ESXRecordT, IdAccessorT>::load (ESM::ESMReader& reader, bool base)
{ {
@ -69,7 +78,7 @@ namespace CSMWorld
record = this->getRecord (index).get(); record = this->getRecord (index).get();
} }
record.load (reader); loadRecord (record, reader);
if (index==-1) if (index==-1)
{ {

@ -0,0 +1,35 @@
#include "pathgrid.hpp"
#include <sstream>
void CSMWorld::Pathgrid::load (ESM::ESMReader &esm, const IdCollection<Cell>& cells)
{
load (esm);
// correct ID
if (!mId.empty() && mId[0]!='#' && cells.searchId (mId)==-1)
{
std::ostringstream stream;
stream << "#" << mData.mX << " " << mData.mY;
mId = stream.str();
}
}
void CSMWorld::Pathgrid::load (ESM::ESMReader &esm)
{
ESM::Pathgrid::load (esm);
if (mCell.empty())
{
std::ostringstream stream;
stream << "#" << mData.mX << " " << mData.mY;
mId = stream.str();
}
else
mId = mCell;
}

@ -0,0 +1,28 @@
#ifndef CSM_WOLRD_PATHGRID_H
#define CSM_WOLRD_PATHGRID_H
#include <vector>
#include <string>
#include <components/esm/loadpgrd.hpp>
#include "idcollection.hpp"
#include "cell.hpp"
namespace CSMWorld
{
/// \brief Wrapper for Pathgrid record
///
/// \attention The mData.mX and mData.mY fields of the ESM::Pathgrid struct are not used.
/// Exterior cell coordinates are encoded in the pathgrid ID.
struct Pathgrid : public ESM::Pathgrid
{
std::string mId;
void load (ESM::ESMReader &esm, const IdCollection<Cell>& cells);
void load (ESM::ESMReader &esm);
};
}
#endif

@ -0,0 +1,38 @@
#ifndef CSM_WOLRD_SUBCOLLECTION_H
#define CSM_WOLRD_SUBCOLLECTION_H
#include "idcollection.hpp"
namespace CSMWorld
{
/// \brief Single type collection of top level records that are associated with cells
template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT> >
class SubCellCollection : public IdCollection<ESXRecordT, IdAccessorT>
{
const IdCollection<Cell>& mCells;
virtual void loadRecord (ESXRecordT& record, ESM::ESMReader& reader);
public:
SubCellCollection (const IdCollection<Cell>& cells);
};
template<typename ESXRecordT, typename IdAccessorT>
void SubCellCollection<ESXRecordT, IdAccessorT>::loadRecord (ESXRecordT& record,
ESM::ESMReader& reader)
{
record.load (reader, mCells);
}
template<typename ESXRecordT, typename IdAccessorT>
SubCellCollection<ESXRecordT, IdAccessorT>::SubCellCollection (
const IdCollection<Cell>& cells)
: mCells (cells)
{}
}
#endif

@ -52,6 +52,9 @@ namespace
{ CSMWorld::UniversalId::Class_ResourceList, CSMWorld::UniversalId::Type_Videos, "Videos", 0 }, { CSMWorld::UniversalId::Class_ResourceList, CSMWorld::UniversalId::Type_Videos, "Videos", 0 },
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_DebugProfiles, "Debug Profiles", 0 }, { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_DebugProfiles, "Debug Profiles", 0 },
{ CSMWorld::UniversalId::Class_Transient, CSMWorld::UniversalId::Type_RunLog, "Run Log", 0 }, { CSMWorld::UniversalId::Class_Transient, CSMWorld::UniversalId::Type_RunLog, "Run Log", 0 },
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_SoundGens, "Sound Generators", 0 },
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_MagicEffects, "Magic Effects", 0 },
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Pathgrids, "Pathgrids", 0 },
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker
}; };
@ -112,6 +115,9 @@ namespace
{ CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Texture, "Texture", 0 }, { CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Texture, "Texture", 0 },
{ CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Video, "Video", 0 }, { CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Video, "Video", 0 },
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_DebugProfile, "Debug Profile", 0 }, { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_DebugProfile, "Debug Profile", 0 },
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_SoundGen, "Sound Generator", 0 },
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_MagicEffect, "Magic Effect", 0 },
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Pathgrid, "Pathgrid", 0 },
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker
}; };

@ -122,10 +122,16 @@ namespace CSMWorld
Type_Video, Type_Video,
Type_DebugProfiles, Type_DebugProfiles,
Type_DebugProfile, Type_DebugProfile,
Type_SoundGens,
Type_SoundGen,
Type_MagicEffects,
Type_MagicEffect,
Type_Pathgrids,
Type_Pathgrid,
Type_RunLog Type_RunLog
}; };
enum { NumberOfTypes = Type_DebugProfile+1 }; enum { NumberOfTypes = Type_RunLog+1 };
private: private:

@ -135,6 +135,10 @@ void CSVDoc::View::setupWorldMenu()
connect (references, SIGNAL (triggered()), this, SLOT (addReferencesSubView())); connect (references, SIGNAL (triggered()), this, SLOT (addReferencesSubView()));
world->addAction (references); world->addAction (references);
QAction *grid = new QAction (tr ("Pathgrid"), this);
connect (grid, SIGNAL (triggered()), this, SLOT (addPathgridSubView()));
world->addAction (grid);
world->addSeparator(); // items that don't represent single record lists follow here world->addSeparator(); // items that don't represent single record lists follow here
QAction *regionMap = new QAction (tr ("Region Map"), this); QAction *regionMap = new QAction (tr ("Region Map"), this);
@ -165,6 +169,10 @@ void CSVDoc::View::setupMechanicsMenu()
QAction *enchantments = new QAction (tr ("Enchantments"), this); QAction *enchantments = new QAction (tr ("Enchantments"), this);
connect (enchantments, SIGNAL (triggered()), this, SLOT (addEnchantmentsSubView())); connect (enchantments, SIGNAL (triggered()), this, SLOT (addEnchantmentsSubView()));
mechanics->addAction (enchantments); mechanics->addAction (enchantments);
QAction *effects = new QAction (tr ("Magic Effects"), this);
connect (effects, SIGNAL (triggered()), this, SLOT (addMagicEffectsSubView()));
mechanics->addAction (effects);
} }
void CSVDoc::View::setupCharacterMenu() void CSVDoc::View::setupCharacterMenu()
@ -220,6 +228,10 @@ void CSVDoc::View::setupAssetsMenu()
connect (sounds, SIGNAL (triggered()), this, SLOT (addSoundsSubView())); connect (sounds, SIGNAL (triggered()), this, SLOT (addSoundsSubView()));
assets->addAction (sounds); assets->addAction (sounds);
QAction *soundGens = new QAction (tr ("Sound Generators"), this);
connect (soundGens, SIGNAL (triggered()), this, SLOT (addSoundGensSubView()));
assets->addAction (soundGens);
assets->addSeparator(); // resources follow here assets->addSeparator(); // resources follow here
QAction *meshes = new QAction (tr ("Meshes"), this); QAction *meshes = new QAction (tr ("Meshes"), this);
@ -634,6 +646,11 @@ void CSVDoc::View::addBodyPartsSubView()
addSubView (CSMWorld::UniversalId::Type_BodyParts); addSubView (CSMWorld::UniversalId::Type_BodyParts);
} }
void CSVDoc::View::addSoundGensSubView()
{
addSubView (CSMWorld::UniversalId::Type_SoundGens);
}
void CSVDoc::View::addMeshesSubView() void CSVDoc::View::addMeshesSubView()
{ {
addSubView (CSMWorld::UniversalId::Type_Meshes); addSubView (CSMWorld::UniversalId::Type_Meshes);
@ -654,6 +671,11 @@ void CSVDoc::View::addSoundsResSubView()
addSubView (CSMWorld::UniversalId::Type_SoundsRes); addSubView (CSMWorld::UniversalId::Type_SoundsRes);
} }
void CSVDoc::View::addMagicEffectsSubView()
{
addSubView (CSMWorld::UniversalId::Type_MagicEffects);
}
void CSVDoc::View::addTexturesSubView() void CSVDoc::View::addTexturesSubView()
{ {
addSubView (CSMWorld::UniversalId::Type_Textures); addSubView (CSMWorld::UniversalId::Type_Textures);
@ -674,6 +696,11 @@ void CSVDoc::View::addRunLogSubView()
addSubView (CSMWorld::UniversalId::Type_RunLog); addSubView (CSMWorld::UniversalId::Type_RunLog);
} }
void CSVDoc::View::addPathgridSubView()
{
addSubView (CSMWorld::UniversalId::Type_Pathgrids);
}
void CSVDoc::View::abortOperation (int type) void CSVDoc::View::abortOperation (int type)
{ {
mDocument->abortOperation (type); mDocument->abortOperation (type);

@ -193,6 +193,10 @@ namespace CSVDoc
void addBodyPartsSubView(); void addBodyPartsSubView();
void addSoundGensSubView();
void addMagicEffectsSubView();
void addMeshesSubView(); void addMeshesSubView();
void addIconsSubView(); void addIconsSubView();
@ -209,6 +213,8 @@ namespace CSVDoc
void addRunLogSubView(); void addRunLogSubView();
void addPathgridSubView();
void toggleShowStatusBar (bool show); void toggleShowStatusBar (bool show);
void loadErrorLog(); void loadErrorLog();

@ -82,7 +82,9 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
{ CSMWorld::ColumnBase::Display_EnchantmentType, CSMWorld::Columns::ColumnId_EnchantmentType, false }, { CSMWorld::ColumnBase::Display_EnchantmentType, CSMWorld::Columns::ColumnId_EnchantmentType, false },
{ CSMWorld::ColumnBase::Display_BodyPartType, CSMWorld::Columns::ColumnId_BodyPartType, false }, { CSMWorld::ColumnBase::Display_BodyPartType, CSMWorld::Columns::ColumnId_BodyPartType, false },
{ CSMWorld::ColumnBase::Display_MeshType, CSMWorld::Columns::ColumnId_MeshType, false }, { CSMWorld::ColumnBase::Display_MeshType, CSMWorld::Columns::ColumnId_MeshType, false },
{ CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true } { CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true },
{ CSMWorld::ColumnBase::Display_SoundGeneratorType, CSMWorld::Columns::ColumnId_SoundGeneratorType, false },
{ CSMWorld::ColumnBase::Display_School, CSMWorld::Columns::ColumnId_School, true }
}; };
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i) for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)

@ -303,7 +303,8 @@ std::string CSVRender::PagedWorldspaceWidget::getStartupInstruction()
} }
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document) CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document)
: WorldspaceWidget(document, parent), mDocument(document), mWorldspace("std::default"), mDisplayCellCoord(true) : WorldspaceWidget (document, parent), mDocument (document), mWorldspace ("std::default"),
mControlElements(NULL), mDisplayCellCoord(true)
{ {
QAbstractItemModel *cells = QAbstractItemModel *cells =
document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells); document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells);

@ -23,10 +23,12 @@ namespace CSVRender
{ {
SceneWidget::SceneWidget(QWidget *parent) SceneWidget::SceneWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, mWindow(NULL)
, mCamera(NULL) , mCamera(NULL)
, mSceneMgr(NULL), mNavigation (0), mLighting (0), mUpdate (false) , mSceneMgr(NULL)
, mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false) , mWindow(NULL)
, mViewport(NULL)
, mNavigation (0), mLighting (0), mUpdate (false), mKeyForward (false)
, mKeyBackward (false), mKeyLeft (false), mKeyRight (false)
, mKeyRollLeft (false), mKeyRollRight (false) , mKeyRollLeft (false), mKeyRollRight (false)
, mFast (false), mDragging (false), mMod1 (false) , mFast (false), mDragging (false), mMod1 (false)
, mFastFactor (4) , mFastFactor (4)

@ -19,7 +19,7 @@
#include "elements.hpp" #include "elements.hpp"
CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent) CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent)
: SceneWidget (parent), mDocument(document), mRun (0) : SceneWidget (parent), mDocument(document), mSceneElements(0), mRun(0)
{ {
setAcceptDrops(true); setAcceptDrops(true);

@ -9,7 +9,7 @@
#include "view.hpp" #include "view.hpp"
CSVSettings::SettingWindow::SettingWindow(QWidget *parent) CSVSettings::SettingWindow::SettingWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent), mModel(NULL)
{} {}
void CSVSettings::SettingWindow::createPages() void CSVSettings::SettingWindow::createPages()
@ -84,7 +84,7 @@ void CSVSettings::SettingWindow::createConnections
void CSVSettings::SettingWindow::setViewValues() void CSVSettings::SettingWindow::setViewValues()
{ {
//iterate each page and view, setting their definintions //iterate each page and view, setting their definitions
//if they exist in the model //if they exist in the model
foreach (const Page *page, mPages) foreach (const Page *page, mPages)
{ {

@ -26,6 +26,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
manager.add (CSMWorld::UniversalId::Type_Skills, manager.add (CSMWorld::UniversalId::Type_Skills,
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>); new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
manager.add (CSMWorld::UniversalId::Type_MagicEffects,
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
static const CSMWorld::UniversalId::Type sTableTypes[] = static const CSMWorld::UniversalId::Type sTableTypes[] =
{ {
CSMWorld::UniversalId::Type_Globals, CSMWorld::UniversalId::Type_Globals,
@ -38,6 +41,8 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
CSMWorld::UniversalId::Type_Spells, CSMWorld::UniversalId::Type_Spells,
CSMWorld::UniversalId::Type_Enchantments, CSMWorld::UniversalId::Type_Enchantments,
CSMWorld::UniversalId::Type_BodyParts, CSMWorld::UniversalId::Type_BodyParts,
CSMWorld::UniversalId::Type_SoundGens,
CSMWorld::UniversalId::Type_Pathgrids,
CSMWorld::UniversalId::Type_None // end marker CSMWorld::UniversalId::Type_None // end marker
}; };
@ -116,6 +121,8 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
CSMWorld::UniversalId::Type_Faction, CSMWorld::UniversalId::Type_Faction,
CSMWorld::UniversalId::Type_Enchantment, CSMWorld::UniversalId::Type_Enchantment,
CSMWorld::UniversalId::Type_BodyPart, CSMWorld::UniversalId::Type_BodyPart,
CSMWorld::UniversalId::Type_SoundGen,
CSMWorld::UniversalId::Type_Pathgrid,
CSMWorld::UniversalId::Type_None // end marker CSMWorld::UniversalId::Type_None // end marker
}; };
@ -128,6 +135,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
manager.add (CSMWorld::UniversalId::Type_Skill, manager.add (CSMWorld::UniversalId::Type_Skill,
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false)); new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false));
manager.add (CSMWorld::UniversalId::Type_MagicEffect,
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false));
manager.add (CSMWorld::UniversalId::Type_Gmst, manager.add (CSMWorld::UniversalId::Type_Gmst,
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false)); new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false));

@ -34,7 +34,7 @@ namespace MWGui
, mSourceModel(NULL) , mSourceModel(NULL)
, mSourceView(NULL) , mSourceView(NULL)
, mSourceSortModel(NULL) , mSourceSortModel(NULL)
, mIsOnDragAndDrop(NULL) , mIsOnDragAndDrop(false)
{ {
} }

@ -74,8 +74,6 @@ namespace MWGui
MyGUI::TextBox* mWeaponSpellBox; MyGUI::TextBox* mWeaponSpellBox;
MyGUI::Widget *mDrowningFrame, *mDrowningFlash; MyGUI::Widget *mDrowningFrame, *mDrowningFlash;
MyGUI::Widget* mDummy;
MyGUI::Widget* mFpsBox; MyGUI::Widget* mFpsBox;
MyGUI::TextBox* mFpsCounter; MyGUI::TextBox* mFpsCounter;
MyGUI::TextBox* mTriangleCounter; MyGUI::TextBox* mTriangleCounter;

@ -39,6 +39,8 @@ namespace MWGui
, mPreviewDirty(true) , mPreviewDirty(true)
, mPreviewResize(true) , mPreviewResize(true)
, mDragAndDrop(dragAndDrop) , mDragAndDrop(dragAndDrop)
, mSortModel(NULL)
, mTradeModel(NULL)
, mSelectedItem(-1) , mSelectedItem(-1)
, mGuiMode(GM_Inventory) , mGuiMode(GM_Inventory)
{ {

@ -29,6 +29,7 @@ namespace MWGui
, mButtonBox(0), mWidth (w), mHeight (h) , mButtonBox(0), mWidth (w), mHeight (h)
, mSaveGameDialog(NULL) , mSaveGameDialog(NULL)
, mBackground(NULL) , mBackground(NULL)
, mVideoBackground(NULL)
, mVideo(NULL) , mVideo(NULL)
{ {
getWidget(mVersionText, "VersionText"); getWidget(mVersionText, "VersionText");
@ -43,7 +44,7 @@ namespace MWGui
rev = rev.substr(0,10); rev = rev.substr(0,10);
sstream << "\nRevision: " << rev; sstream << "\nRevision: " << rev;
} }
std::string output = sstream.str(); std::string output = sstream.str();
mVersionText->setCaption(output); mVersionText->setCaption(output);

@ -447,8 +447,12 @@ namespace MWGui
EffectEditorBase::EffectEditorBase(Type type) EffectEditorBase::EffectEditorBase(Type type)
: mAddEffectDialog() : mAddEffectDialog()
, mAvailableEffectsList(NULL)
, mUsedEffectsView(NULL)
, mSelectAttributeDialog(NULL) , mSelectAttributeDialog(NULL)
, mSelectSkillDialog(NULL) , mSelectSkillDialog(NULL)
, mSelectedEffect(0)
, mSelectedKnownEffectId(0)
, mType(type) , mType(type)
{ {
mAddEffectDialog.eventEffectAdded += MyGUI::newDelegate(this, &EffectEditorBase::onEffectAdded); mAddEffectDialog.eventEffectAdded += MyGUI::newDelegate(this, &EffectEditorBase::onEffectAdded);

@ -79,7 +79,6 @@ namespace MWGui
class SpellCreationDialog; class SpellCreationDialog;
class EnchantingDialog; class EnchantingDialog;
class TrainingWindow; class TrainingWindow;
class Cursor;
class SpellIcons; class SpellIcons;
class MerchantRepair; class MerchantRepair;
class Repair; class Repair;
@ -392,7 +391,6 @@ namespace MWGui
DebugWindow* mDebugWindow; DebugWindow* mDebugWindow;
Translation::Storage& mTranslationDataStorage; Translation::Storage& mTranslationDataStorage;
Cursor* mSoftwareCursor;
CharacterCreation* mCharGen; CharacterCreation* mCharGen;

@ -19,14 +19,14 @@ using namespace Ogre;
OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNode* sunNode) : OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNode* sunNode) :
mSunTotalAreaQuery(0), mSunVisibleAreaQuery(0), mActiveQuery(0), mSunTotalAreaQuery(0), mSunVisibleAreaQuery(0), mActiveQuery(0),
mDoQuery(0), mSunVisibility(0), mBBQueryVisible(0), mBBQueryTotal(0), mSunNode(sunNode), mBBNodeReal(0),
mSunVisibility(0),
mWasVisible(false), mWasVisible(false),
mActive(false), mActive(false),
mFirstFrame(true) mFirstFrame(true),
mDoQuery(0),
mRendering(renderer)
{ {
mRendering = renderer;
mSunNode = sunNode;
try { try {
RenderSystem* renderSystem = Root::getSingleton().getRenderSystem(); RenderSystem* renderSystem = Root::getSingleton().getRenderSystem();

@ -20,10 +20,9 @@ using namespace Ogre;
using namespace MWRender; using namespace MWRender;
Shadows::Shadows(OEngine::Render::OgreRenderer* rend) : Shadows::Shadows(OEngine::Render::OgreRenderer* rend) :
mRendering(rend), mSceneMgr(rend->getScene()), mPSSMSetup(NULL),
mShadowFar(1000), mFadeStart(0.9) mShadowFar(1000), mFadeStart(0.9)
{ {
mRendering = rend;
mSceneMgr = mRendering->getScene();
recreate(); recreate();
} }

@ -69,6 +69,7 @@ BillboardObject::BillboardObject( const String& textureName,
} }
BillboardObject::BillboardObject() BillboardObject::BillboardObject()
: mNode(NULL), mMaterial(NULL), mEntity(NULL)
{ {
} }
@ -222,6 +223,7 @@ SkyManager::SkyManager(Ogre::SceneNode *root, Ogre::Camera *pCamera)
, mCloudOpacity(0.0f) , mCloudOpacity(0.0f)
, mCloudSpeed(0.0f) , mCloudSpeed(0.0f)
, mStarsOpacity(0.0f) , mStarsOpacity(0.0f)
, mLightning(NULL)
, mRemainingTransitionTime(0.0f) , mRemainingTransitionTime(0.0f)
, mGlareFade(0.0f) , mGlareFade(0.0f)
, mGlare(0.0f) , mGlare(0.0f)

@ -590,6 +590,7 @@ namespace MWWorld
typedef SharedIterator<ESM::Cell> iterator; typedef SharedIterator<ESM::Cell> iterator;
Store<ESM::Cell>() Store<ESM::Cell>()
: mEsmStore(NULL)
{} {}
const ESM::Cell *search(const std::string &id) const { const ESM::Cell *search(const std::string &id) const {

@ -65,6 +65,7 @@ namespace Compiler
if (mState==BeginState && keyword==Scanner::K_begin) if (mState==BeginState && keyword==Scanner::K_begin)
{ {
mState = NameState; mState = NameState;
scanner.allowNameStartingwithDigit();
return true; return true;
} }

@ -48,6 +48,9 @@ namespace Compiler
bool Scanner::scanToken (Parser& parser) bool Scanner::scanToken (Parser& parser)
{ {
bool allowDigit = mNameStartingWithDigit;
mNameStartingWithDigit = false;
switch (mPutback) switch (mPutback)
{ {
case Putback_Special: case Putback_Special:
@ -112,6 +115,7 @@ namespace Compiler
else if (isWhitespace (c)) else if (isWhitespace (c))
{ {
mLoc.mLiteral.clear(); mLoc.mLiteral.clear();
mNameStartingWithDigit = allowDigit;
return true; return true;
} }
else if (c==':') else if (c==':')
@ -120,21 +124,21 @@ namespace Compiler
mLoc.mLiteral.clear(); mLoc.mLiteral.clear();
return true; return true;
} }
else if (std::isdigit (c)) else if (std::isalpha (c) || c=='_' || c=='"' || (allowDigit && std::isdigit (c)))
{ {
bool cont = false; bool cont = false;
if (scanInt (c, parser, cont)) if (scanName (c, parser, cont))
{ {
mLoc.mLiteral.clear(); mLoc.mLiteral.clear();
return cont; return cont;
} }
} }
else if (std::isalpha (c) || c=='_' || c=='"') else if (std::isdigit (c))
{ {
bool cont = false; bool cont = false;
if (scanName (c, parser, cont)) if (scanInt (c, parser, cont))
{ {
mLoc.mLiteral.clear(); mLoc.mLiteral.clear();
return cont; return cont;
@ -516,7 +520,8 @@ namespace Compiler
Scanner::Scanner (ErrorHandler& errorHandler, std::istream& inputStream, Scanner::Scanner (ErrorHandler& errorHandler, std::istream& inputStream,
const Extensions *extensions) const Extensions *extensions)
: mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions), : mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions),
mPutback (Putback_None), mPutbackCode(0), mPutbackInteger(0), mPutbackFloat(0) mPutback (Putback_None), mPutbackCode(0), mPutbackInteger(0), mPutbackFloat(0),
mNameStartingWithDigit (false)
{ {
} }
@ -568,4 +573,9 @@ namespace Compiler
if (mExtensions) if (mExtensions)
mExtensions->listKeywords (keywords); mExtensions->listKeywords (keywords);
} }
void Scanner::allowNameStartingwithDigit()
{
mNameStartingWithDigit = true;
}
} }

@ -37,6 +37,7 @@ namespace Compiler
float mPutbackFloat; float mPutbackFloat;
std::string mPutbackName; std::string mPutbackName;
TokenLoc mPutbackLoc; TokenLoc mPutbackLoc;
bool mNameStartingWithDigit;
public: public:
@ -122,6 +123,9 @@ namespace Compiler
void listKeywords (std::vector<std::string>& keywords); void listKeywords (std::vector<std::string>& keywords);
///< Append all known keywords to \a kaywords. ///< Append all known keywords to \a kaywords.
/// For the next token allow names to start with a digit.
void allowNameStartingwithDigit();
}; };
} }

@ -1,6 +1,7 @@
#include "loadmgef.hpp" #include "loadmgef.hpp"
#include <stdexcept> #include <stdexcept>
#include <sstream>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -10,6 +11,157 @@
namespace namespace
{ {
static const char *sIds[ESM::MagicEffect::Length] =
{
"WaterBreathing",
"SwiftSwim",
"WaterWalking",
"Shield",
"FireShield",
"LightningShield",
"FrostShield",
"Burden",
"Feather",
"Jump",
"Levitate",
"SlowFall",
"Lock",
"Open",
"FireDamage",
"ShockDamage",
"FrostDamage",
"DrainAttribute",
"DrainHealth",
"DrainMagicka",
"DrainFatigue",
"DrainSkill",
"DamageAttribute",
"DamageHealth",
"DamageMagicka",
"DamageFatigue",
"DamageSkill",
"Poison",
"WeaknessToFire",
"WeaknessToFrost",
"WeaknessToShock",
"WeaknessToMagicka",
"WeaknessToCommonDisease",
"WeaknessToBlightDisease",
"WeaknessToCorprusDisease",
"WeaknessToPoison",
"WeaknessToNormalWeapons",
"DisintegrateWeapon",
"DisintegrateArmor",
"Invisibility",
"Chameleon",
"Light",
"Sanctuary",
"NightEye",
"Charm",
"Paralyze",
"Silence",
"Blind",
"Sound",
"CalmHumanoid",
"CalmCreature",
"FrenzyHumanoid",
"FrenzyCreature",
"DemoralizeHumanoid",
"DemoralizeCreature",
"RallyHumanoid",
"RallyCreature",
"Dispel",
"Soultrap",
"Telekinesis",
"Mark",
"Recall",
"DivineIntervention",
"AlmsiviIntervention",
"DetectAnimal",
"DetectEnchantment",
"DetectKey",
"SpellAbsorption",
"Reflect",
"CureCommonDisease",
"CureBlightDisease",
"CureCorprusDisease",
"CurePoison",
"CureParalyzation",
"RestoreAttribute",
"RestoreHealth",
"RestoreMagicka",
"RestoreFatigue",
"RestoreSkill",
"FortifyAttribute",
"FortifyHealth",
"FortifyMagicka",
"FortifyFatigue",
"FortifySkill",
"FortifyMaximumMagicka",
"AbsorbAttribute",
"AbsorbHealth",
"AbsorbMagicka",
"AbsorbFatigue",
"AbsorbSkill",
"ResistFire",
"ResistFrost",
"ResistShock",
"ResistMagicka",
"ResistCommonDisease",
"ResistBlightDisease",
"ResistCorprusDisease",
"ResistPoison",
"ResistNormalWeapons",
"ResistParalysis",
"RemoveCurse",
"TurnUndead",
"SummonScamp",
"SummonClannfear",
"SummonDaedroth",
"SummonDremora",
"SummonAncestralGhost",
"SummonSkeletalMinion",
"SummonBonewalker",
"SummonGreaterBonewalker",
"SummonBonelord",
"SummonWingedTwilight",
"SummonHunger",
"SummonGoldenSaint",
"SummonFlameAtronach",
"SummonFrostAtronach",
"SummonStormAtronach",
"FortifyAttack",
"CommandCreature",
"CommandHumanoid",
"BoundDagger",
"BoundLongsword",
"BoundMace",
"BoundBattleAxe",
"BoundSpear",
"BoundLongbow",
"ExtraSpell",
"BoundCuirass",
"BoundHelm",
"BoundBoots",
"BoundShield",
"BoundGloves",
"Corprus",
"Vampirism",
"SummonCenturionSphere",
"SunDamage",
"StuntedMagicka",
// Tribunal only
"SummonFabricant",
// Bloodmoon only
"SummonWolf",
"SummonBear",
"SummonBonewolf",
"SummonCreature04",
"SummonCreature05"
};
const int NumberOfHardcodedFlags = 143; const int NumberOfHardcodedFlags = 143;
const int HardcodedFlags[NumberOfHardcodedFlags] = { const int HardcodedFlags[NumberOfHardcodedFlags] = {
0x11c8, 0x11c0, 0x11c8, 0x11e0, 0x11e0, 0x11e0, 0x11e0, 0x11d0, 0x11c8, 0x11c0, 0x11c8, 0x11e0, 0x11e0, 0x11e0, 0x11e0, 0x11d0,
@ -41,6 +193,8 @@ void MagicEffect::load(ESMReader &esm)
{ {
esm.getHNT(mIndex, "INDX"); esm.getHNT(mIndex, "INDX");
mId = indexToId (mIndex);
esm.getHNT(mData, "MEDT", 36); esm.getHNT(mData, "MEDT", 36);
if (esm.getFormat() == 0) if (esm.getFormat() == 0)
{ {
@ -388,4 +542,51 @@ MagicEffect::MagnitudeDisplayType MagicEffect::getMagnitudeDisplayType() const {
return MDT_Points; return MDT_Points;
} }
void MagicEffect::blank()
{
mData.mSchool = 0;
mData.mBaseCost = 0;
mData.mFlags = 0;
mData.mRed = 0;
mData.mGreen = 0;
mData.mBlue = 0;
mData.mSpeed = 0;
mIcon.clear();
mParticle.clear();
mCasting.clear();
mHit.clear();
mArea.clear();
mBolt.clear();
mCastSound.clear();
mBoltSound.clear();
mHitSound.clear();
mAreaSound.clear();
mDescription.clear();
}
std::string MagicEffect::indexToId (int index)
{
std::ostringstream stream;
if (index!=-1)
{
stream << "#";
if (index<100)
{
stream << "0";
if (index<10)
stream << "0";
}
stream << index;
if (index>=0 && index<Length)
stream << sIds[index];
}
return stream.str();
}
} }

@ -14,6 +14,8 @@ struct MagicEffect
{ {
static unsigned int sRecordId; static unsigned int sRecordId;
std::string mId;
enum Flags enum Flags
{ {
// Originally fixed flags (HardcodedFlags array consists of just these) // Originally fixed flags (HardcodedFlags array consists of just these)
@ -95,6 +97,8 @@ struct MagicEffect
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;
/// Set record to default state (does not touch the ID/index).
void blank();
enum Effects enum Effects
{ {
@ -248,6 +252,8 @@ struct MagicEffect
Length Length
}; };
static std::string indexToId (int index);
}; };
} }
#endif #endif

@ -115,4 +115,14 @@ void Pathgrid::save(ESMWriter &esm) const
} }
} }
void Pathgrid::blank()
{
mCell.clear();
mData.mX = 0;
mData.mY = 0;
mData.mS1 = 0;
mData.mS2 = 0;
mPoints.clear();
mEdges.clear();
}
} }

@ -53,6 +53,8 @@ struct Pathgrid
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;
void blank();
}; };
} }
#endif #endif

@ -22,4 +22,10 @@ void SoundGenerator::save(ESMWriter &esm) const
esm.writeHNOCString("SNAM", mSound); esm.writeHNOCString("SNAM", mSound);
} }
void SoundGenerator::blank()
{
mType = LeftFoot;
mCreature.clear();
mSound.clear();
}
} }

@ -36,6 +36,8 @@ struct SoundGenerator
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;
void blank();
}; };
} }
#endif #endif

Loading…
Cancel
Save