From 37a2b48fa285eea3b0060a4b4afb2b67e004f474 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 1 Jul 2014 14:28:12 +0200 Subject: [PATCH] added missing type columns to body part table --- apps/opencs/model/world/columnbase.hpp | 2 + apps/opencs/model/world/columnimp.hpp | 53 ++++++++++++++++++++++++++ apps/opencs/model/world/columns.cpp | 15 ++++++++ apps/opencs/model/world/columns.hpp | 2 + apps/opencs/model/world/data.cpp | 5 +-- apps/opencs/view/doc/viewmanager.cpp | 2 + 6 files changed, 76 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/world/columnbase.hpp b/apps/opencs/model/world/columnbase.hpp index 3de610320..39c700fa1 100644 --- a/apps/opencs/model/world/columnbase.hpp +++ b/apps/opencs/model/world/columnbase.hpp @@ -90,6 +90,8 @@ namespace CSMWorld Display_DialogueType, Display_QuestStatusType, Display_EnchantmentType, + Display_BodyPartType, + Display_MeshType, Display_Gender }; diff --git a/apps/opencs/model/world/columnimp.hpp b/apps/opencs/model/world/columnimp.hpp index 5844e97a7..72f2099fa 100644 --- a/apps/opencs/model/world/columnimp.hpp +++ b/apps/opencs/model/world/columnimp.hpp @@ -1817,6 +1817,59 @@ namespace CSMWorld } }; + template + struct BodyPartTypeColumn : public Column + { + BodyPartTypeColumn() + : Column (Columns::ColumnId_BodyPartType, ColumnBase::Display_BodyPartType) + {} + + virtual QVariant get (const Record& record) const + { + return static_cast (record.get().mData.mPart); + } + + virtual void set (Record& record, const QVariant& data) + { + ESXRecordT record2 = record.get(); + + record2.mData.mPart = data.toInt(); + + record.setModified (record2); + } + + virtual bool isEditable() const + { + return true; + } + }; + + template + struct MeshTypeColumn : public Column + { + MeshTypeColumn() + : Column (Columns::ColumnId_MeshType, ColumnBase::Display_MeshType) + {} + + virtual QVariant get (const Record& record) const + { + return static_cast (record.get().mData.mType); + } + + virtual void set (Record& record, const QVariant& data) + { + ESXRecordT record2 = record.get(); + + record2.mData.mType = data.toInt(); + + record.setModified (record2); + } + + virtual bool isEditable() const + { + return true; + } + }; } #endif diff --git a/apps/opencs/model/world/columns.cpp b/apps/opencs/model/world/columns.cpp index 3d363aac4..05df0b735 100644 --- a/apps/opencs/model/world/columns.cpp +++ b/apps/opencs/model/world/columns.cpp @@ -179,6 +179,8 @@ namespace CSMWorld { ColumnId_StealthState, "Stealth" }, { ColumnId_EnchantmentType, "Enchantment Type" }, { ColumnId_Vampire, "Vampire" }, + { ColumnId_BodyPartType, "Bodypart Type" }, + { ColumnId_MeshType, "Mesh Type" }, { ColumnId_UseValue1, "Use value 1" }, { ColumnId_UseValue2, "Use value 2" }, @@ -309,6 +311,17 @@ namespace "Cast Once", "When Strikes", "When Used", "Constant Effect", 0 }; + static const char *sBodyPartTypes[] = + { + "Head", "Hair", "Neck", "Chest", "Groin", "Hand", "Wrist", "Forearm", "Upper Arm", + "Foot", "Ankle", "Knee", "Upper Leg", "Clavicle", "Tail", 0 + }; + + static const char *sMeshTypes[] = + { + "Skin", "Clothing", "Armour", 0 + }; + const char **getEnumNames (CSMWorld::Columns::ColumnId column) { switch (column) @@ -327,6 +340,8 @@ namespace case CSMWorld::Columns::ColumnId_QuestStatusType: return sQuestStatusTypes; case CSMWorld::Columns::ColumnId_Gender: return sGenderEnums; case CSMWorld::Columns::ColumnId_EnchantmentType: return sEnchantmentTypes; + case CSMWorld::Columns::ColumnId_BodyPartType: return sBodyPartTypes; + case CSMWorld::Columns::ColumnId_MeshType: return sMeshTypes; default: return 0; } diff --git a/apps/opencs/model/world/columns.hpp b/apps/opencs/model/world/columns.hpp index bb6c0e453..326a02596 100644 --- a/apps/opencs/model/world/columns.hpp +++ b/apps/opencs/model/world/columns.hpp @@ -172,6 +172,8 @@ namespace CSMWorld ColumnId_StealthState = 159, ColumnId_EnchantmentType = 160, ColumnId_Vampire = 161, + ColumnId_BodyPartType = 162, + ColumnId_MeshType = 163, // Allocated to a separate value range, so we don't get a collision should we ever need // to extend the number of use values. diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 0353d2142..aad5d3fa2 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -209,15 +209,14 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding) mBodyParts.addColumn (new StringIdColumn); mBodyParts.addColumn (new RecordStateColumn); mBodyParts.addColumn (new FixedRecordTypeColumn (UniversalId::Type_BodyPart)); - + mBodyParts.addColumn (new BodyPartTypeColumn); mBodyParts.addColumn (new VampireColumn); mBodyParts.addColumn (new FlagColumn (Columns::ColumnId_Female, ESM::BodyPart::BPF_Female)); mBodyParts.addColumn (new FlagColumn (Columns::ColumnId_Playable, ESM::BodyPart::BPF_NotPlayable, true)); - + mBodyParts.addColumn (new MeshTypeColumn); mBodyParts.addColumn (new ModelColumn); mBodyParts.addColumn (new RaceColumn); - mRefs.addColumn (new StringIdColumn (true)); mRefs.addColumn (new RecordStateColumn); mRefs.addColumn (new FixedRecordTypeColumn (UniversalId::Type_Reference)); diff --git a/apps/opencs/view/doc/viewmanager.cpp b/apps/opencs/view/doc/viewmanager.cpp index 14607b49e..6f4217aa8 100644 --- a/apps/opencs/view/doc/viewmanager.cpp +++ b/apps/opencs/view/doc/viewmanager.cpp @@ -79,6 +79,8 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager) { CSMWorld::ColumnBase::Display_DialogueType, CSMWorld::Columns::ColumnId_DialogueType, false }, { CSMWorld::ColumnBase::Display_QuestStatusType, CSMWorld::Columns::ColumnId_QuestStatusType, false }, { CSMWorld::ColumnBase::Display_EnchantmentType, CSMWorld::Columns::ColumnId_EnchantmentType, false }, + { CSMWorld::ColumnBase::Display_BodyPartType, CSMWorld::Columns::ColumnId_BodyPartType, false }, + { CSMWorld::ColumnBase::Display_MeshType, CSMWorld::Columns::ColumnId_MeshType, false }, { CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true } };