1 #ifndef OPENMW_ESSIMPORT_CONVERTER_H
2 #define OPENMW_ESSIMPORT_CONVERTER_H
87 bool isDeleted =
false;
89 record.load(esm, isDeleted);
95 for (
typename std::map<std::string, T>::const_iterator it =
mRecords.begin(); it !=
mRecords.end(); ++it)
113 bool isDeleted =
false;
115 npc.
load(esm, isDeleted);
116 if (npc.
mId !=
"player")
151 bool isDeleted =
false;
153 creature.
load(esm, isDeleted);
168 bool isDeleted =
false;
170 global.
load(esm, isDeleted);
189 bool isDeleted =
false;
191 class_.
load(esm, isDeleted);
192 if (class_.
mId ==
"NEWCLASSID_CHARGEN")
205 bool isDeleted =
false;
207 book.
load(esm, isDeleted);
223 if (
id ==
"PlayerSaveGame")
242 assert(refr.
mRefID ==
"PlayerSaveGame");
256 for (
unsigned int i=0; i<invState.
mItems.size(); ++i)
395 bool isDeleted =
false;
397 faction.
load(esm, isDeleted);
400 for (std::map<std::string, int>::const_iterator it = faction.
mReactions.begin(); it != faction.
mReactions.end(); ++it)
434 for (std::map<std::string, std::set<Owner> >::const_iterator it =
mStolenItems.begin(); it !=
mStolenItems.end(); ++it)
436 std::map<std::pair<std::string, bool>,
int> owners;
437 for (std::set<Owner>::const_iterator ownerIt = it->second.begin(); ownerIt != it->second.end(); ++ownerIt)
439 owners.insert(std::make_pair(std::make_pair(ownerIt->first, ownerIt->second)
444 ,std::numeric_limits<int>::max()));
447 items.
mStolenItems.insert(std::make_pair(it->first, owners));
456 typedef std::pair<std::string, bool>
Owner;
490 for (std::map<std::string, DIAL>::const_iterator it =
mDials.begin(); it !=
mDials.end(); ++it)
495 state.
mState = it->second.mIndex;
542 if(weatherID >= -1 && weatherID < 10)
548 std::stringstream error;
549 error <<
"Invalid weather ID:" << weatherID << std::endl;
550 throw std::runtime_error(error.str());
591 for (std::vector<ESM::GlobalScript>::const_iterator it =
mScripts.begin(); it !=
mScripts.end(); ++it)
bool mLevitationEnabled
Definition: converter.hpp:304
Definition: converter.hpp:516
void load(ESMReader &esm, bool &isDeleted)
Definition: loadbook.cpp:11
virtual void write(ESM::ESMWriter &esm)
Definition: converter.cpp:438
std::string mName
Definition: loadclas.hpp:73
std::map< std::string, int > mKillCounter
RefId, kill count.
Definition: importklst.hpp:21
static bool ciEqual(const std::string &x, const std::string &y)
Definition: stringops.hpp:129
int mMonth
Definition: importercontext.hpp:43
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:589
std::string getHNString(const char *name)
Definition: esmreader.cpp:109
Definition: stolenitems.hpp:13
std::string mSelectedSpell
Definition: converter.hpp:271
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:264
void writeHNT(const std::string &name, const T &data)
Definition: esmwriter.hpp:78
void load(ESM::ESMReader &esm)
Definition: importinfo.cpp:8
Definition: converter.hpp:614
GAME mGame
Definition: converter.hpp:574
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:412
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:554
std::map< std::string, std::set< Owner > > mStolenItems
Definition: converter.hpp:458
float mTimeOfNextTransition
Definition: importgame.hpp:22
std::string mId
Definition: loadcrea.hpp:88
void load(ESM::ESMReader &esm)
Definition: importklst.cpp:8
std::vector< ESM::GlobalScript > mScripts
Definition: converter.hpp:599
std::string mTopic
Definition: queststate.hpp:15
virtual int getStage()
Definition: converter.hpp:54
std::map< std::string, T > mRecords
Definition: converter.hpp:104
Definition: converter.hpp:318
int mIndex
Definition: importcntc.hpp:17
std::vector< ObjectState > mItems
Definition: inventorystate.hpp:18
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:110
void load(ESM::ESMReader &esm)
Definition: importgame.cpp:8
Definition: converter.hpp:477
Context * mContext
Definition: converter.hpp:74
std::string mRefID
Definition: importplayer.hpp:26
Definition: importproj.h:16
Definition: esmreader.hpp:21
std::map< std::pair< int, int >, Cell > mExtCells
Definition: converter.hpp:355
void startRecord(const std::string &name, uint32_t flags=0)
Definition: esmwriter.cpp:89
Definition: queststate.hpp:13
Definition: importques.hpp:18
void load(ESMReader &esm, bool &isDeleted)
Definition: loadglob.cpp:11
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:488
int mNextWeather
Definition: importgame.hpp:20
int mLevel
Definition: creaturestats.hpp:64
ConvertGAME()
Definition: converter.hpp:529
CreatureStats mCreatureStats
Definition: npcstate.hpp:17
Definition: converter.hpp:330
void load(ESM::ESMReader &esm)
Definition: importplayer.cpp:19
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:392
int mNextWeather
Definition: weatherstate.hpp:27
void convertACDT(const ACDT &acdt, ESM::CreatureStats &cStats)
Definition: convertacdt.cpp:21
static std::string lowerCase(const std::string &in)
Returns lower case copy of input string.
Definition: stringops.hpp:177
Definition: importercontext.hpp:25
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:309
Definition: converter.hpp:274
std::map< std::pair< int, std::string >, CREC > mCreatureChanges
Definition: importercontext.hpp:47
Storage structure for global script state (only used in saved games)
Definition: globalscript.hpp:13
Definition: converter.hpp:526
std::map< std::string, int > mKillCounter
Definition: converter.hpp:386
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:321
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:202
virtual void write(ESM::ESMWriter &esm) override
Definition: converter.cpp:459
int mDay
Definition: importercontext.hpp:43
std::vector< CellRef > mRefs
Definition: converter.hpp:350
ESM::NPC mPlayerBase
Definition: importercontext.hpp:31
void writeHNString(const std::string &name, const std::string &data)
Definition: esmwriter.cpp:158
NpcStats mNpcStats
Definition: npcstate.hpp:16
std::string mId
Definition: loadbook.hpp:29
Definition: loadcrea.hpp:22
Definition: converter.hpp:199
struct ESSImport::NPCC::NPDT mNPDT
void load(ESMReader &esm, bool &isDeleted)
Definition: loadclas.cpp:41
NpcState mObject
Definition: player.hpp:22
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:431
int mWerewolfKills
Definition: npcstats.hpp:37
void convertBaseState(ESM::BaseProjectileState &base, const PROJ::PNAM &pnam)
Definition: converter.cpp:500
Projectile converter.
Definition: converter.hpp:603
void load(ESMReader &esm, bool &isDeleted)
Definition: loadfact.cpp:29
Definition: importsplm.h:16
int mIndex
Definition: importdial.hpp:13
Definition: loadglob.hpp:18
Definition: importnpcc.hpp:18
std::string mSelectedSpell
Definition: importacdt.hpp:81
ActorData mActorData
Definition: importplayer.hpp:24
SpellList mSpells
Definition: loadnpc.hpp:122
ConvertPCDT()
Definition: converter.hpp:277
InventoryList mInventory
Definition: loadnpc.hpp:121
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:147
BKDTstruct mData
Definition: loadbook.hpp:27
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:290
void write(ESM::ESMWriter &esm) const
Definition: stolenitems.cpp:9
std::vector< std::string > mKnownTopics
Definition: dialoguestate.hpp:18
bool mHasGame
Definition: converter.hpp:573
Definition: importscpt.hpp:17
Journal.
Definition: importjour.hpp:15
Variant mValue
Definition: loadglob.hpp:25
Definition: projectilestate.hpp:18
int mState
Definition: queststate.hpp:16
Definition: converter.hpp:50
void save(ESMWriter &esm) const
Definition: queststate.cpp:13
Definition: converter.hpp:389
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:218
std::string mId
Definition: loadfact.hpp:36
void load(ESM::ESMReader &esm)
Definition: importnpcc.cpp:8
std::map< std::string, ESM::NPC > mNpcs
Definition: importercontext.hpp:55
Kill Stats.
Definition: importklst.hpp:16
Definition: esmwriter.hpp:17
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:374
virtual void write(ESM::ESMWriter &esm)
Definition: converter.cpp:120
Definition: converter.hpp:162
std::vector< ContItem > mList
Definition: loadcont.hpp:28
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:186
Definition: creaturestats.hpp:23
std::string mId
Definition: loadclas.hpp:73
void save(ESMWriter &esm) const
Definition: weatherstate.cpp:50
void convertPCDT(const PCDT &pcdt, ESM::Player &out, std::vector< std::string > &outDialogueTopics, bool &firstPersonCam, bool &teleportingEnabled, bool &levitationEnabled, ESM::ControlsState &controls)
Definition: convertplayer.cpp:9
int mWerewolfKills
Definition: importklst.hpp:23
virtual ~Converter()
Definition: converter.hpp:56
void load(ESMReader &esm, bool &isDeleted)
Definition: loadnpc.cpp:11
Definition: converter.hpp:362
bool mFastForward
Definition: weatherstate.hpp:23
Definition: converter.hpp:307
int mWeatherTransition
Definition: importgame.hpp:21
Definition: loadnpc.hpp:23
void setContext(Context &context)
Definition: converter.hpp:58
std::string mSelectedEnchantItem
Definition: importacdt.hpp:82
ESM::Position mPosition
Definition: objectstate.hpp:27
virtual int getStage()
Definition: converter.hpp:82
virtual void write(ESM::ESMWriter &esm) override
Definition: converter.cpp:518
void load(ESM::ESMReader &esm)
Definition: importcntc.cpp:8
std::string mId
Definition: loadnpc.hpp:133
SpellState mSpells
Definition: creaturestats.hpp:66
Running global script.
Definition: converter.hpp:578
Creature changes.
Definition: importcrec.hpp:16
std::string toString() const
Definition: esmcommon.hpp:58
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:68
void load(ESM::ESMReader &esm)
Definition: importdial.cpp:8
int mYear
Definition: importercontext.hpp:43
std::vector< unsigned int > mFogOfWar
Definition: converter.hpp:351
void load(ESMReader &esm, bool &isDeleted)
Definition: loadcrea.cpp:13
int mSkillId
Definition: loadbook.hpp:24
virtual int getStage() override
Definition: converter.hpp:606
int mCurrentWeather
Definition: importgame.hpp:20
NPDTstruct52 mNpdt
Definition: loadnpc.hpp:113
ESM::ControlsState mControlsState
Definition: importercontext.hpp:36
SPLM mSPLM
Definition: converter.hpp:620
float mWeatherUpdateTime
Definition: weatherstate.hpp:24
TypesetBook::Ptr book
Definition: journalbooks.cpp:157
int getInteger() const
Definition: variant.cpp:82
virtual void read(ESM::ESMReader &esm)
Definition: converter.cpp:101
void load(ESM::ESMReader &esm)
Definition: importplayer.cpp:8
virtual void read(ESM::ESMReader &esm)
Definition: converter.cpp:194
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:165
State for inventories and containers.
Definition: inventorystate.hpp:16
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:365
TContainer mSpells
Definition: spellstate.hpp:37
virtual void read(ESM::ESMReader &esm) override
Definition: converter.cpp:512
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:84
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:62
Definition: spellstate.hpp:32
static void lowerCaseInPlace(std::string &inout)
Transforms input string to lower case w/o copy.
Definition: stringops.hpp:171
Definition: loadcell.hpp:64
std::map< std::string, int > mReactions
Definition: loadfact.hpp:60
Default converter: simply reads the record and writes it unmodified to the output.
Definition: converter.hpp:79
int mIndex
Definition: importcrec.hpp:18
void load(ESM::ESMReader &esm)
Definition: importcrec.cpp:8
std::vector< std::string > mUsedIds
Definition: npcstats.hpp:41
void convertNpcData(const ActorData &actorData, ESM::NpcStats &npcStats)
Definition: convertacdt.cpp:46
Definition: converter.hpp:183
float mTimePassed
Definition: weatherstate.hpp:22
std::string mId
Definition: loadglob.hpp:24
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:534
Definition: weatherstate.hpp:19
InventoryState mInventory
Definition: npcstate.hpp:15
ESM::Cell mCell
Definition: converter.hpp:349
StolenItemsMap mStolenItems
Definition: stolenitems.hpp:16
std::pair< std::string, bool > Owner
Definition: converter.hpp:456
const NAME & retSubName() const
Definition: esmreader.hpp:41
ESM::Player mPlayer
Definition: importercontext.hpp:30
int mSelectedEnchantItem
Definition: inventorystate.hpp:28
ESM::DialogueState mDialogueState
Definition: importercontext.hpp:34
int mIndex
Definition: importnpcc.hpp:26
Definition: loadclas.hpp:18
std::map< std::pair< int, std::string >, CNTC > mContainerChanges
Definition: importercontext.hpp:49
std::string getHString()
Definition: esmreader.cpp:115
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:283
Definition: converter.hpp:467
void endRecord(const std::string &name)
Definition: esmwriter.cpp:132
virtual void read(ESM::ESMReader &esm) override
Definition: converter.cpp:454
void convertSCPT(const SCPT &scpt, ESM::GlobalScript &out)
Definition: convertscpt.cpp:10
Definition: importinfo.hpp:14
virtual void write(ESM::ESMWriter &esm)
Definition: converter.hpp:93
float getFloat() const
Will throw an exception, if value can not be represented as a float value.
Definition: variant.cpp:90
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:480
bool mTeleportingEnabled
Definition: converter.hpp:303
Player-agnostic player data.
Definition: importplayer.hpp:22
Weather data.
Definition: importgame.hpp:13
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:581
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:238
Definition: converter.hpp:144
void load(ESM::ESMReader &esm)
Definition: importscpt.cpp:10
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:470
Definition: converter.hpp:107
ESM::Position mPos
Definition: importplayer.hpp:27
std::vector< std::string > mList
Definition: spelllist.hpp:18
float mTransitionFactor
Definition: weatherstate.hpp:25
std::map< std::string, Cell > mIntCells
Definition: converter.hpp:354
Definition: npcstats.hpp:17
int validateWeatherID(int weatherID)
Definition: converter.hpp:540
std::vector< ESM::CustomMarker > mMarkers
Definition: converter.hpp:357
Stolen items.
Definition: converter.hpp:409
Definition: loadfact.hpp:30
Definition: importproj.h:21
Other player data.
Definition: importplayer.hpp:34
bool isNextSub(const char *name)
Definition: esmreader.cpp:165
std::map< std::string, DIAL > mDials
Definition: converter.hpp:502
int mCurrentWeather
Definition: weatherstate.hpp:26
std::map< std::string, ESM::Creature > mCreatures
Definition: importercontext.hpp:54
osg::ref_ptr< osg::Image > mGlobalMapImage
Definition: converter.hpp:337
std::map< std::string, std::map< std::string, int > > mChangedFactionReaction
Definition: dialoguestate.hpp:21
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:519
void writeCell(const Cell &cell, ESM::ESMWriter &esm)
Definition: converter.cpp:319
int mQueuedWeather
Definition: weatherstate.hpp:28
unsigned char mFinished
Definition: queststate.hpp:17
std::string mCustomPlayerClassName
Definition: importercontext.hpp:32
GMDT mGMDT
Definition: importgame.hpp:26
Definition: converter.hpp:215
Definition: loadbook.hpp:15
Definition: converter.hpp:235
Definition: converter.hpp:340
void convertNPCC(const NPCC &npcc, ESM::NpcState &npcState)
Definition: convertnpcc.cpp:8
void load(ESM::ESMReader &esm)
Definition: importjour.cpp:8
std::map< std::pair< int, std::string >, NPCC > mNpcChanges
Definition: importercontext.hpp:48
PROJ mProj
Definition: converter.hpp:611
void load(ESM::ESMReader &esm)
Definition: importques.cpp:8
virtual void read(ESM::ESMReader &esm)
Definition: converter.hpp:508
Changed container contents.
Definition: importcntc.hpp:15
Definition: converter.hpp:347
float mHour
Definition: importercontext.hpp:44
short mLevel
Definition: loadnpc.hpp:78
Definition: importdial.hpp:11
ACDT mACDT
Definition: importacdt.hpp:69
Definition: converter.hpp:505
bool mFirstPersonCam
Definition: converter.hpp:302