added missing columns to topic info table

pull/136/head
Marc Zinnschlag 11 years ago
parent 4724df7e9b
commit 9d7695ea88

@ -740,8 +740,8 @@ void Record<ESM::DialInfo>::print()
if (mData.mClass != "") if (mData.mClass != "")
std::cout << " Class: " << mData.mClass << std::endl; std::cout << " Class: " << mData.mClass << std::endl;
std::cout << " Factionless: " << mData.mFactionLess << std::endl; std::cout << " Factionless: " << mData.mFactionLess << std::endl;
if (mData.mNpcFaction != "") if (mData.mFaction != "")
std::cout << " NPC Faction: " << mData.mNpcFaction << std::endl; std::cout << " NPC Faction: " << mData.mFaction << std::endl;
if (mData.mData.mRank != -1) if (mData.mData.mRank != -1)
std::cout << " NPC Rank: " << (int)mData.mData.mRank << std::endl; std::cout << " NPC Rank: " << (int)mData.mData.mRank << std::endl;
if (mData.mPcFaction != "") if (mData.mPcFaction != "")

@ -45,7 +45,8 @@ namespace CSMWorld
Display_RecordState, Display_RecordState,
Display_RefRecordType, Display_RefRecordType,
Display_DialogueType, Display_DialogueType,
Display_QuestStatusType Display_QuestStatusType,
Display_Gender
}; };
int mColumnId; int mColumnId;

@ -815,14 +815,14 @@ namespace CSMWorld
virtual QVariant get (const Record<ESXRecordT>& record) const virtual QVariant get (const Record<ESXRecordT>& record) const
{ {
return QString::fromUtf8 (record.get().mCellId.c_str()); return QString::fromUtf8 (record.get().mCell.c_str());
} }
virtual void set (Record<ESXRecordT>& record, const QVariant& data) virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{ {
ESXRecordT record2 = record.get(); ESXRecordT record2 = record.get();
record2.mCellId = data.toString().toUtf8().constData(); record2.mCell = data.toString().toUtf8().constData();
record.setModified (record2); record.setModified (record2);
} }
@ -1425,6 +1425,233 @@ namespace CSMWorld
return false; return false;
} }
}; };
template<typename ESXRecordT>
struct ActorColumn : public Column<ESXRecordT>
{
ActorColumn() : Column<ESXRecordT> (Columns::ColumnId_Actor, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mActor.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mActor = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct RaceColumn : public Column<ESXRecordT>
{
RaceColumn() : Column<ESXRecordT> (Columns::ColumnId_Race, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mRace.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mRace = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct ClassColumn : public Column<ESXRecordT>
{
ClassColumn() : Column<ESXRecordT> (Columns::ColumnId_Class, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mClass.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mClass = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct PcFactionColumn : public Column<ESXRecordT>
{
PcFactionColumn() : Column<ESXRecordT> (Columns::ColumnId_PcFaction, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mPcFaction.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mPcFaction = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct ResponseColumn : public Column<ESXRecordT>
{
ResponseColumn() : Column<ESXRecordT> (Columns::ColumnId_Response, ColumnBase::Display_String) {}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return QString::fromUtf8 (record.get().mResponse.c_str());
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mResponse = data.toString().toUtf8().constData();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct DispositionColumn : public Column<ESXRecordT>
{
DispositionColumn()
: Column<ESXRecordT> (Columns::ColumnId_Disposition, ColumnBase::Display_Integer)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return record.get().mData.mDisposition;
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mData.mDisposition = data.toInt();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct RankColumn : public Column<ESXRecordT>
{
RankColumn()
: Column<ESXRecordT> (Columns::ColumnId_Rank, ColumnBase::Display_Integer)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return static_cast<int> (record.get().mData.mRank);
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mData.mRank = static_cast<signed char> (data.toInt());
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct PcRankColumn : public Column<ESXRecordT>
{
PcRankColumn()
: Column<ESXRecordT> (Columns::ColumnId_PcRank, ColumnBase::Display_Integer)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return static_cast<int> (record.get().mData.mPCrank);
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mData.mPCrank = static_cast<signed char> (data.toInt());
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
template<typename ESXRecordT>
struct GenderColumn : public Column<ESXRecordT>
{
GenderColumn()
: Column<ESXRecordT> (Columns::ColumnId_Gender, ColumnBase::Display_Gender)
{}
virtual QVariant get (const Record<ESXRecordT>& record) const
{
return static_cast<int> (record.get().mData.mGender);
}
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
{
ESXRecordT record2 = record.get();
record2.mData.mGender = data.toInt();
record.setModified (record2);
}
virtual bool isEditable() const
{
return true;
}
};
} }
#endif #endif

@ -164,7 +164,14 @@ namespace CSMWorld
{ ColumnId_QuestStatusType, "Quest Status" }, { ColumnId_QuestStatusType, "Quest Status" },
{ ColumnId_QuestDescription, "Quest Description" }, { ColumnId_QuestDescription, "Quest Description" },
{ ColumnId_Topic, "Topic" }, { ColumnId_Topic, "Topic" },
{ ColumnId_Journal, "Journal", }, { ColumnId_Journal, "Journal" },
{ ColumnId_Actor, "Actor" },
{ ColumnId_PcFaction, "PC Faction" },
{ ColumnId_Response, "Response" },
{ ColumnId_Disposition, "Disposition" },
{ ColumnId_Rank, "Rank" },
{ ColumnId_Gender, "Gender" },
{ ColumnId_PcRank, "PC Rank" },
{ ColumnId_UseValue1, "Use value 1" }, { ColumnId_UseValue1, "Use value 1" },
{ ColumnId_UseValue2, "Use value 2" }, { ColumnId_UseValue2, "Use value 2" },
@ -285,6 +292,11 @@ namespace
"None", "Name", "Finished", "Restart", 0 "None", "Name", "Finished", "Restart", 0
}; };
static const char *sGenderEnums[] =
{
"Male", "Female", 0
};
const char **getEnumNames (CSMWorld::Columns::ColumnId column) const char **getEnumNames (CSMWorld::Columns::ColumnId column)
{ {
switch (column) switch (column)
@ -301,6 +313,7 @@ namespace
case CSMWorld::Columns::ColumnId_ValueType: return sVarTypeEnums; case CSMWorld::Columns::ColumnId_ValueType: return sVarTypeEnums;
case CSMWorld::Columns::ColumnId_DialogueType: return sDialogueTypeEnums; case CSMWorld::Columns::ColumnId_DialogueType: return sDialogueTypeEnums;
case CSMWorld::Columns::ColumnId_QuestStatusType: return sQuestStatusTypes; case CSMWorld::Columns::ColumnId_QuestStatusType: return sQuestStatusTypes;
case CSMWorld::Columns::ColumnId_Gender: return sGenderEnums;
default: return 0; default: return 0;
} }

@ -158,6 +158,13 @@ namespace CSMWorld
ColumnId_QuestDescription = 145, ColumnId_QuestDescription = 145,
ColumnId_Topic = 146, ColumnId_Topic = 146,
ColumnId_Journal = 147, ColumnId_Journal = 147,
ColumnId_Actor = 148,
ColumnId_PcFaction = 149,
ColumnId_Response = 150,
ColumnId_Disposition = 151,
ColumnId_Rank = 152,
ColumnId_Gender = 153,
ColumnId_PcRank = 154,
// 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.

@ -152,6 +152,18 @@ CSMWorld::Data::Data() : mRefs (mCells)
mTopicInfos.addColumn (new StringIdColumn<Info>); mTopicInfos.addColumn (new StringIdColumn<Info>);
mTopicInfos.addColumn (new RecordStateColumn<Info>); mTopicInfos.addColumn (new RecordStateColumn<Info>);
mTopicInfos.addColumn (new TopicColumn<Info> (false)); mTopicInfos.addColumn (new TopicColumn<Info> (false));
mTopicInfos.addColumn (new ActorColumn<Info>);
mTopicInfos.addColumn (new RaceColumn<Info>);
mTopicInfos.addColumn (new ClassColumn<Info>);
mTopicInfos.addColumn (new FactionColumn<Info>);
mTopicInfos.addColumn (new CellColumn<Info>);
mTopicInfos.addColumn (new DispositionColumn<Info>);
mTopicInfos.addColumn (new RankColumn<Info>);
mTopicInfos.addColumn (new GenderColumn<Info>);
mTopicInfos.addColumn (new PcFactionColumn<Info>);
mTopicInfos.addColumn (new PcRankColumn<Info>);
mTopicInfos.addColumn (new SoundFileColumn<Info>);
mTopicInfos.addColumn (new ResponseColumn<Info>);
mJournalInfos.addColumn (new StringIdColumn<Info>); mJournalInfos.addColumn (new StringIdColumn<Info>);
mJournalInfos.addColumn (new RecordStateColumn<Info>); mJournalInfos.addColumn (new RecordStateColumn<Info>);

@ -6,7 +6,7 @@
void CSMWorld::CellRef::load (ESM::ESMReader &esm, Cell& cell, const std::string& id) void CSMWorld::CellRef::load (ESM::ESMReader &esm, Cell& cell, const std::string& id)
{ {
mId = id; mId = id;
mCellId = cell.mId; mCell = cell.mId;
if (!mDeleted) if (!mDeleted)
cell.addRef (mId); cell.addRef (mId);

@ -16,7 +16,7 @@ namespace CSMWorld
struct CellRef : public ESM::CellRef struct CellRef : public ESM::CellRef
{ {
std::string mId; std::string mId;
std::string mCellId; std::string mCell;
void load (ESM::ESMReader &esm, Cell& cell, const std::string& id); void load (ESM::ESMReader &esm, Cell& cell, const std::string& id);
///< Load cell ref and register it with \a cell. ///< Load cell ref and register it with \a cell.

@ -76,7 +76,8 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
{ CSMWorld::ColumnBase::Display_CreatureType, CSMWorld::Columns::ColumnId_CreatureType, false }, { CSMWorld::ColumnBase::Display_CreatureType, CSMWorld::Columns::ColumnId_CreatureType, false },
{ CSMWorld::ColumnBase::Display_WeaponType, CSMWorld::Columns::ColumnId_WeaponType, false }, { CSMWorld::ColumnBase::Display_WeaponType, CSMWorld::Columns::ColumnId_WeaponType, false },
{ CSMWorld::ColumnBase::Display_DialogueType, CSMWorld::Columns::ColumnId_DialogueType, false }, { CSMWorld::ColumnBase::Display_DialogueType, CSMWorld::Columns::ColumnId_DialogueType, false },
{ CSMWorld::ColumnBase::Display_QuestStatusType, CSMWorld::Columns::ColumnId_QuestStatusType, false } { CSMWorld::ColumnBase::Display_QuestStatusType, CSMWorld::Columns::ColumnId_QuestStatusType, false },
{ CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, 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)

@ -58,13 +58,13 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
} }
// NPC faction // NPC faction
if (!info.mNpcFaction.empty()) if (!info.mFaction.empty())
{ {
if (isCreature) if (isCreature)
return false; return false;
MWMechanics::NpcStats& stats = MWWorld::Class::get (mActor).getNpcStats (mActor); MWMechanics::NpcStats& stats = MWWorld::Class::get (mActor).getNpcStats (mActor);
std::map<std::string, int>::iterator iter = stats.getFactionRanks().find ( Misc::StringUtils::lowerCase (info.mNpcFaction)); std::map<std::string, int>::iterator iter = stats.getFactionRanks().find ( Misc::StringUtils::lowerCase (info.mFaction));
if (iter==stats.getFactionRanks().end()) if (iter==stats.getFactionRanks().end())
return false; return false;

@ -48,8 +48,8 @@ void DialInfo::load(ESMReader &esm)
mFactionLess = false; mFactionLess = false;
if (subName.val == REC_FNAM) if (subName.val == REC_FNAM)
{ {
mNpcFaction = esm.getHString(); mFaction = esm.getHString();
if (mNpcFaction == "FFFF") if (mFaction == "FFFF")
mFactionLess = true; mFactionLess = true;
if (esm.isEmptyOrGetName()) if (esm.isEmptyOrGetName())
return; return;
@ -129,7 +129,7 @@ void DialInfo::save(ESMWriter &esm)
esm.writeHNOCString("ONAM", mActor); esm.writeHNOCString("ONAM", mActor);
esm.writeHNOCString("RNAM", mRace); esm.writeHNOCString("RNAM", mRace);
esm.writeHNOCString("CNAM", mClass); esm.writeHNOCString("CNAM", mClass);
esm.writeHNOCString("FNAM", mNpcFaction); esm.writeHNOCString("FNAM", mFaction);
esm.writeHNOCString("ANAM", mCell); esm.writeHNOCString("ANAM", mCell);
esm.writeHNOCString("DNAM", mPcFaction); esm.writeHNOCString("DNAM", mPcFaction);
esm.writeHNOCString("SNAM", mSound); esm.writeHNOCString("SNAM", mSound);
@ -168,7 +168,7 @@ void DialInfo::save(ESMWriter &esm)
mActor.clear(); mActor.clear();
mRace.clear(); mRace.clear();
mClass.clear(); mClass.clear();
mNpcFaction.clear(); mFaction.clear();
mPcFaction.clear(); mPcFaction.clear();
mCell.clear(); mCell.clear();
mSound.clear(); mSound.clear();

@ -63,7 +63,7 @@ struct DialInfo
std::string mId, mPrev, mNext; std::string mId, mPrev, mNext;
// Various references used in determining when to select this item. // Various references used in determining when to select this item.
std::string mActor, mRace, mClass, mNpcFaction, mPcFaction, mCell; std::string mActor, mRace, mClass, mFaction, mPcFaction, mCell;
// Sound and text associated with this item // Sound and text associated with this item
std::string mSound, mResponse; std::string mSound, mResponse;

Loading…
Cancel
Save