mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 10:23:56 +00:00
added missing columns for door record
This commit is contained in:
parent
889a87982e
commit
749fd418b5
4 changed files with 61 additions and 2 deletions
|
@ -287,3 +287,39 @@ void CSMWorld::CreatureRefIdAdapter::setData (const RefIdColumn *column, RefIdDa
|
||||||
ActorRefIdAdapter<ESM::Creature>::setData (column, data, index, value);
|
ActorRefIdAdapter<ESM::Creature>::setData (column, data, index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSMWorld::DoorRefIdAdapter::DoorRefIdAdapter (const NameColumns& columns,
|
||||||
|
const RefIdColumn *openSound, const RefIdColumn *closeSound)
|
||||||
|
: NameRefIdAdapter<ESM::Door> (UniversalId::Type_Door, columns), mOpenSound (openSound),
|
||||||
|
mCloseSound (closeSound)
|
||||||
|
{}
|
||||||
|
|
||||||
|
QVariant CSMWorld::DoorRefIdAdapter::getData (const RefIdColumn *column, const RefIdData& data,
|
||||||
|
int index) const
|
||||||
|
{
|
||||||
|
const Record<ESM::Door>& record = static_cast<const Record<ESM::Door>&> (
|
||||||
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Door)));
|
||||||
|
|
||||||
|
if (column==mOpenSound)
|
||||||
|
return QString::fromUtf8 (record.get().mOpenSound.c_str());
|
||||||
|
|
||||||
|
if (column==mCloseSound)
|
||||||
|
return QString::fromUtf8 (record.get().mCloseSound.c_str());
|
||||||
|
|
||||||
|
return NameRefIdAdapter<ESM::Door>::getData (column, data, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMWorld::DoorRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
||||||
|
const QVariant& value) const
|
||||||
|
{
|
||||||
|
Record<ESM::Door>& record = static_cast<Record<ESM::Door>&> (
|
||||||
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Door)));
|
||||||
|
|
||||||
|
if (column==mOpenSound)
|
||||||
|
record.get().mOpenSound = value.toString().toUtf8().constData();
|
||||||
|
else if (column==mCloseSound)
|
||||||
|
record.get().mCloseSound = value.toString().toUtf8().constData();
|
||||||
|
else
|
||||||
|
NameRefIdAdapter<ESM::Door>::setData (column, data, index, value);
|
||||||
|
}
|
|
@ -642,6 +642,24 @@ namespace CSMWorld
|
||||||
const QVariant& value) const;
|
const QVariant& value) const;
|
||||||
///< If the data type does not match an exception is thrown.
|
///< If the data type does not match an exception is thrown.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DoorRefIdAdapter : public NameRefIdAdapter<ESM::Door>
|
||||||
|
{
|
||||||
|
const RefIdColumn *mOpenSound;
|
||||||
|
const RefIdColumn *mCloseSound;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DoorRefIdAdapter (const NameColumns& columns, const RefIdColumn *openSound,
|
||||||
|
const RefIdColumn *closeSound);
|
||||||
|
|
||||||
|
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int index)
|
||||||
|
const;
|
||||||
|
|
||||||
|
virtual void setData (const RefIdColumn *column, RefIdData& data, int index,
|
||||||
|
const QVariant& value) const;
|
||||||
|
///< If the data type does not match an exception is thrown.
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -197,6 +197,12 @@ CSMWorld::RefIdCollection::RefIdCollection()
|
||||||
|
|
||||||
creatureColumns.mFlags.insert (std::make_pair (respawn, ESM::Creature::Respawn));
|
creatureColumns.mFlags.insert (std::make_pair (respawn, ESM::Creature::Respawn));
|
||||||
|
|
||||||
|
mColumns.push_back (RefIdColumn ("Open Sound", ColumnBase::Display_String));
|
||||||
|
const RefIdColumn *openSound = &mColumns.back();
|
||||||
|
|
||||||
|
mColumns.push_back (RefIdColumn ("Close Sound", ColumnBase::Display_String));
|
||||||
|
const RefIdColumn *closeSound = &mColumns.back();
|
||||||
|
|
||||||
mAdapters.insert (std::make_pair (UniversalId::Type_Activator,
|
mAdapters.insert (std::make_pair (UniversalId::Type_Activator,
|
||||||
new NameRefIdAdapter<ESM::Activator> (UniversalId::Type_Activator, nameColumns)));
|
new NameRefIdAdapter<ESM::Activator> (UniversalId::Type_Activator, nameColumns)));
|
||||||
mAdapters.insert (std::make_pair (UniversalId::Type_Potion,
|
mAdapters.insert (std::make_pair (UniversalId::Type_Potion,
|
||||||
|
@ -214,7 +220,7 @@ CSMWorld::RefIdCollection::RefIdCollection()
|
||||||
mAdapters.insert (std::make_pair (UniversalId::Type_Creature,
|
mAdapters.insert (std::make_pair (UniversalId::Type_Creature,
|
||||||
new CreatureRefIdAdapter (creatureColumns)));
|
new CreatureRefIdAdapter (creatureColumns)));
|
||||||
mAdapters.insert (std::make_pair (UniversalId::Type_Door,
|
mAdapters.insert (std::make_pair (UniversalId::Type_Door,
|
||||||
new NameRefIdAdapter<ESM::Door> (UniversalId::Type_Door, nameColumns)));
|
new DoorRefIdAdapter (nameColumns, openSound, closeSound)));
|
||||||
mAdapters.insert (std::make_pair (UniversalId::Type_Ingredient,
|
mAdapters.insert (std::make_pair (UniversalId::Type_Ingredient,
|
||||||
new InventoryRefIdAdapter<ESM::Ingredient> (UniversalId::Type_Ingredient, inventoryColumns)));
|
new InventoryRefIdAdapter<ESM::Ingredient> (UniversalId::Type_Ingredient, inventoryColumns)));
|
||||||
mAdapters.insert (std::make_pair (UniversalId::Type_CreatureLevelledList,
|
mAdapters.insert (std::make_pair (UniversalId::Type_CreatureLevelledList,
|
||||||
|
|
|
@ -89,7 +89,6 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual int getAppendIndex (UniversalId::Type type) const;
|
virtual int getAppendIndex (UniversalId::Type type) const;
|
||||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue