Merge remote-tracking branch 'matahualpa/openmw-cs_gender'

pull/157/head
Marc Zinnschlag 8 years ago
commit bef0b1f1d6

@ -138,6 +138,7 @@ namespace CSMWorld
Display_EffectSkill, // must display at least one, unlike Display_Skill
Display_EffectAttribute, // must display at least one, unlike Display_Attribute
Display_IngredEffectId, // display none allowed, unlike Display_EffectId
Display_GenderNpc, // must display at least one, unlike Display_Gender
//top level columns that nest other columns
Display_NestedHeader

@ -283,6 +283,7 @@ namespace CSMWorld
{ ColumnId_NpcMisc, "NPC Misc" },
{ ColumnId_Level, "Level" },
{ ColumnId_NpcFactionID, "Faction ID" },
{ ColumnId_GenderNpc, "Gender"},
{ ColumnId_Mana, "Mana" },
{ ColumnId_Fatigue, "Fatigue" },
{ ColumnId_NpcDisposition, "NPC Disposition" },

@ -276,7 +276,7 @@ namespace CSMWorld
ColumnId_NpcMisc = 251,
ColumnId_Level = 252,
ColumnId_NpcFactionID = 253,
// unused
ColumnId_GenderNpc = 254,
ColumnId_Mana = 255,
ColumnId_Fatigue = 256,
ColumnId_NpcDisposition = 257,

@ -756,7 +756,8 @@ CSMWorld::NpcColumns::NpcColumns (const ActorColumns& actorColumns)
mAttributes(NULL),
mSkills(NULL),
mMisc(NULL),
mBloodType(NULL)
mBloodType(NULL),
mGender(NULL)
{}
CSMWorld::NpcRefIdAdapter::NpcRefIdAdapter (const NpcColumns& columns)
@ -808,6 +809,15 @@ QVariant CSMWorld::NpcRefIdAdapter::getData (const RefIdColumn *column, const Re
return 0;
}
if (column == mColumns.mGender)
{
// Implemented this way to allow additional gender types in the future.
if ((record.get().mFlags & ESM::NPC::Female) == ESM::NPC::Female)
return 1;
return 0;
}
std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
mColumns.mFlags.find (column);
@ -846,6 +856,14 @@ void CSMWorld::NpcRefIdAdapter::setData (const RefIdColumn *column, RefIdData& d
else
npc.mFlags = npc.mFlags & mask;
}
else if (column == mColumns.mGender)
{
// Implemented this way to allow additional gender types in the future.
if (value.toInt() == 1)
npc.mFlags = (npc.mFlags & ~ESM::NPC::Female) | ESM::NPC::Female;
else
npc.mFlags = npc.mFlags & ~ESM::NPC::Female;
}
else
{
std::map<const RefIdColumn *, unsigned int>::const_iterator iter =

@ -852,6 +852,7 @@ namespace CSMWorld
const RefIdColumn *mSkills; // depends on npc type
const RefIdColumn *mMisc; // may depend on npc type, e.g. FactionID
const RefIdColumn *mBloodType;
const RefIdColumn *mGender;
NpcColumns (const ActorColumns& actorColumns);
};

@ -486,8 +486,8 @@ CSMWorld::RefIdCollection::RefIdCollection()
mColumns.push_back (RefIdColumn (Columns::ColumnId_Head, ColumnBase::Display_BodyPart));
npcColumns.mHead = &mColumns.back();
mColumns.push_back (RefIdColumn (Columns::ColumnId_Female, ColumnBase::Display_Boolean));
npcColumns.mFlags.insert (std::make_pair (&mColumns.back(), ESM::NPC::Female));
mColumns.push_back (RefIdColumn (Columns::ColumnId_GenderNpc, ColumnBase::Display_GenderNpc));
npcColumns.mGender = &mColumns.back();
npcColumns.mFlags.insert (std::make_pair (essential, ESM::NPC::Essential));

@ -107,9 +107,10 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
{ CSMWorld::ColumnBase::Display_IngredEffectId, CSMWorld::Columns::ColumnId_EffectId, true },
{ CSMWorld::ColumnBase::Display_EffectSkill, CSMWorld::Columns::ColumnId_Skill, false },
{ CSMWorld::ColumnBase::Display_EffectAttribute, CSMWorld::Columns::ColumnId_Attribute, false },
{ CSMWorld::ColumnBase::Display_BookType, CSMWorld::Columns::ColumnId_BookType, false},
{ CSMWorld::ColumnBase::Display_BloodType, CSMWorld::Columns::ColumnId_BloodType, false},
{ CSMWorld::ColumnBase::Display_EmitterType, CSMWorld::Columns::ColumnId_EmitterType, false}
{ CSMWorld::ColumnBase::Display_BookType, CSMWorld::Columns::ColumnId_BookType, false },
{ CSMWorld::ColumnBase::Display_BloodType, CSMWorld::Columns::ColumnId_BloodType, false },
{ CSMWorld::ColumnBase::Display_EmitterType, CSMWorld::Columns::ColumnId_EmitterType, false },
{ CSMWorld::ColumnBase::Display_GenderNpc, CSMWorld::Columns::ColumnId_Gender, false }
};
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)

Loading…
Cancel
Save