summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Zinnschlag <marc@zpages.de>2016-12-16 12:28:09 +0100
committerMarc Zinnschlag <marc@zpages.de>2016-12-16 12:28:09 +0100
commit827c78a4cd4f11d26eb58dfa06c50f4e6ede525f (patch)
treeafb44c38eee7acfae68a78f215414bf3957762ad
parent762460f04200afbc7a95011b4d684be0838fd52d (diff)
added text column to ref id table (books)
-rw-r--r--apps/opencs/model/world/columns.cpp2
-rw-r--r--apps/opencs/model/world/columns.hpp2
-rw-r--r--apps/opencs/model/world/refidadapterimp.cpp9
-rw-r--r--apps/opencs/model/world/refidadapterimp.hpp3
-rw-r--r--apps/opencs/model/world/refidcollection.cpp5
5 files changed, 17 insertions, 4 deletions
diff --git a/apps/opencs/model/world/columns.cpp b/apps/opencs/model/world/columns.cpp
index c116ec4..028a759 100644
--- a/apps/opencs/model/world/columns.cpp
+++ b/apps/opencs/model/world/columns.cpp
@@ -330,6 +330,8 @@ namespace CSMWorld
{ ColumnId_WeatherName, "Type" },
{ ColumnId_WeatherChance, "Percent Chance" },
+ { ColumnId_Text, "Text" },
+
{ ColumnId_UseValue1, "Use value 1" },
{ ColumnId_UseValue2, "Use value 2" },
{ ColumnId_UseValue3, "Use value 3" },
diff --git a/apps/opencs/model/world/columns.hpp b/apps/opencs/model/world/columns.hpp
index 05bedb7..e3899af 100644
--- a/apps/opencs/model/world/columns.hpp
+++ b/apps/opencs/model/world/columns.hpp
@@ -329,6 +329,8 @@ namespace CSMWorld
ColumnId_WeatherName = 295,
ColumnId_WeatherChance = 296,
+ ColumnId_Text = 297,
+
// Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of use values.
ColumnId_UseValue1 = 0x10000,
diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp
index 5f48b43..086e95c 100644
--- a/apps/opencs/model/world/refidadapterimp.cpp
+++ b/apps/opencs/model/world/refidadapterimp.cpp
@@ -301,9 +301,9 @@ void CSMWorld::ArmorRefIdAdapter::setData (const RefIdColumn *column, RefIdData&
}
CSMWorld::BookRefIdAdapter::BookRefIdAdapter (const EnchantableColumns& columns,
- const RefIdColumn *scroll, const RefIdColumn *skill)
+ const RefIdColumn *scroll, const RefIdColumn *skill, const RefIdColumn *text)
: EnchantableRefIdAdapter<ESM::Book> (UniversalId::Type_Book, columns),
- mScroll (scroll), mSkill (skill)
+ mScroll (scroll), mSkill (skill), mText (text)
{}
QVariant CSMWorld::BookRefIdAdapter::getData (const RefIdColumn *column,
@@ -318,6 +318,9 @@ QVariant CSMWorld::BookRefIdAdapter::getData (const RefIdColumn *column,
if (column==mSkill)
return record.get().mData.mSkillID;
+ if (column==mText)
+ return QString::fromUtf8 (record.get().mText.c_str());
+
return EnchantableRefIdAdapter<ESM::Book>::getData (column, data, index);
}
@@ -333,6 +336,8 @@ void CSMWorld::BookRefIdAdapter::setData (const RefIdColumn *column, RefIdData&
book.mData.mIsScroll = value.toInt();
else if (column==mSkill)
book.mData.mSkillID = value.toInt();
+ else if (column==mText)
+ book.mText = value.toString().toUtf8().data();
else
{
EnchantableRefIdAdapter<ESM::Book>::setData (column, data, index, value);
diff --git a/apps/opencs/model/world/refidadapterimp.hpp b/apps/opencs/model/world/refidadapterimp.hpp
index e828a7f..757a8ad 100644
--- a/apps/opencs/model/world/refidadapterimp.hpp
+++ b/apps/opencs/model/world/refidadapterimp.hpp
@@ -696,11 +696,12 @@ namespace CSMWorld
{
const RefIdColumn *mScroll;
const RefIdColumn *mSkill;
+ const RefIdColumn *mText;
public:
BookRefIdAdapter (const EnchantableColumns& columns, const RefIdColumn *scroll,
- const RefIdColumn *skill);
+ const RefIdColumn *skill, const RefIdColumn *text);
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int index)
const;
diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp
index c4c8f86..74867d6 100644
--- a/apps/opencs/model/world/refidcollection.cpp
+++ b/apps/opencs/model/world/refidcollection.cpp
@@ -297,6 +297,9 @@ CSMWorld::RefIdCollection::RefIdCollection()
mColumns.push_back (RefIdColumn (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute));
const RefIdColumn *attribute = &mColumns.back();
+ mColumns.push_back (RefIdColumn (Columns::ColumnId_Text, ColumnBase::Display_LongString));
+ const RefIdColumn *text = &mColumns.back();
+
mColumns.push_back (RefIdColumn (Columns::ColumnId_ClothingType, ColumnBase::Display_ClothingType));
const RefIdColumn *clothingType = &mColumns.back();
@@ -656,7 +659,7 @@ CSMWorld::RefIdCollection::RefIdCollection()
mAdapters.insert (std::make_pair (UniversalId::Type_Armor,
new ArmorRefIdAdapter (enchantableColumns, armorType, health, armor, partRef)));
mAdapters.insert (std::make_pair (UniversalId::Type_Book,
- new BookRefIdAdapter (enchantableColumns, scroll, attribute)));
+ new BookRefIdAdapter (enchantableColumns, scroll, attribute, text)));
mAdapters.insert (std::make_pair (UniversalId::Type_Clothing,
new ClothingRefIdAdapter (enchantableColumns, clothingType, partRef)));
mAdapters.insert (std::make_pair (UniversalId::Type_Container,