From 114f99ddbf0b0e6fb99c116e0622ab9da7dbd47d Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 24 Mar 2013 15:10:03 +0100 Subject: [PATCH] add skill records when creating a new base file --- apps/opencs/model/doc/document.cpp | 10 ++++++++++ apps/opencs/model/world/data.cpp | 10 ++++++++++ apps/opencs/model/world/data.hpp | 4 ++++ components/esm/loadskil.cpp | 32 ++++++++++++++++++------------ components/esm/loadskil.hpp | 2 ++ 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 47cf1f6642..deafe8eb84 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -198,6 +198,16 @@ void CSMDoc::Document::createBase() } /// \todo add GMSTs + + for (int i=0; i<27; ++i) + { + ESM::Skill record; + record.mIndex = i; + record.mId = ESM::Skill::getIndexToId (record.mIndex); + record.blank(); + + getData().getSkills().add (record); + } } CSMDoc::Document::Document (const std::vector& files, bool new_) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 1b65fecc03..bc78cb46be 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -74,6 +74,16 @@ CSMWorld::IdCollection& CSMWorld::Data::getGmsts() return mGmsts; } +const CSMWorld::IdCollection& CSMWorld::Data::getSkills() const +{ + return mSkills; +} + +CSMWorld::IdCollection& CSMWorld::Data::getSkills() +{ + return mSkills; +} + QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id) { std::map::iterator iter = mModelIndex.find (id.getType()); diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index dc9aee0618..ac953dbece 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -46,6 +46,10 @@ namespace CSMWorld IdCollection& getGmsts(); + const IdCollection& getSkills() const; + + IdCollection& getSkills(); + QAbstractItemModel *getTableModel (const UniversalId& id); ///< If no table model is available for \a id, an exception is thrown. /// diff --git a/components/esm/loadskil.cpp b/components/esm/loadskil.cpp index ac9fc27897..b9d588eef4 100644 --- a/components/esm/loadskil.cpp +++ b/components/esm/loadskil.cpp @@ -103,19 +103,7 @@ void Skill::load(ESMReader &esm) // create an ID from the index and the name (only used in the editor and likely to change in the // future) - std::ostringstream stream; - - stream << "#"; - - if (mIndex<10) - stream << "0"; - - stream << mIndex; - - if (mIndex>=0 && mIndex=0 && index