mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
added var type column to globals
This commit is contained in:
parent
dc3edc6024
commit
46de45b9a2
6 changed files with 28 additions and 10 deletions
|
@ -152,7 +152,7 @@ void CSMDoc::Document::addOptionalGlobals()
|
||||||
{
|
{
|
||||||
ESM::Global global;
|
ESM::Global global;
|
||||||
global.mId = sGlobals[i];
|
global.mId = sGlobals[i];
|
||||||
global.mValue.setType (ESM::VT_Int);
|
global.mValue.setType (ESM::VT_Long);
|
||||||
addOptionalGlobal (global);
|
addOptionalGlobal (global);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ namespace CSMWorld
|
||||||
Display_Integer,
|
Display_Integer,
|
||||||
Display_Float,
|
Display_Float,
|
||||||
Display_Var,
|
Display_Var,
|
||||||
Display_VarType
|
Display_GmstVarType,
|
||||||
|
Display_GlobalVarType
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string mTitle;
|
std::string mTitle;
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace CSMWorld
|
||||||
template<typename ESXRecordT>
|
template<typename ESXRecordT>
|
||||||
struct VarTypeColumn : public Column<ESXRecordT>
|
struct VarTypeColumn : public Column<ESXRecordT>
|
||||||
{
|
{
|
||||||
VarTypeColumn() : Column<ESXRecordT> ("Type", ColumnBase::Display_VarType) {}
|
VarTypeColumn (ColumnBase::Display display) : Column<ESXRecordT> ("Type", display) {}
|
||||||
|
|
||||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
{
|
{
|
||||||
|
@ -125,9 +125,19 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
switch (record.get().mValue.getType())
|
switch (record.get().mValue.getType())
|
||||||
{
|
{
|
||||||
case ESM::VT_String: return record.get().mValue.getString().c_str(); break;
|
case ESM::VT_String:
|
||||||
case ESM::VT_Int: return record.get().mValue.getInteger(); break;
|
|
||||||
case ESM::VT_Float: return record.get().mValue.getFloat(); break;
|
return record.get().mValue.getString().c_str(); break;
|
||||||
|
|
||||||
|
case ESM::VT_Int:
|
||||||
|
case ESM::VT_Short:
|
||||||
|
case ESM::VT_Long:
|
||||||
|
|
||||||
|
return record.get().mValue.getInteger(); break;
|
||||||
|
|
||||||
|
case ESM::VT_Float:
|
||||||
|
|
||||||
|
return record.get().mValue.getFloat(); break;
|
||||||
|
|
||||||
default: return QVariant();
|
default: return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -145,6 +155,8 @@ namespace CSMWorld
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::VT_Int:
|
case ESM::VT_Int:
|
||||||
|
case ESM::VT_Short:
|
||||||
|
case ESM::VT_Long:
|
||||||
|
|
||||||
record2.mValue.setInteger (data.toInt());
|
record2.mValue.setInteger (data.toInt());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -27,12 +27,13 @@ CSMWorld::Data::Data()
|
||||||
mGlobals.addColumn (new StringIdColumn<ESM::Global>);
|
mGlobals.addColumn (new StringIdColumn<ESM::Global>);
|
||||||
mGlobals.addColumn (new RecordStateColumn<ESM::Global>);
|
mGlobals.addColumn (new RecordStateColumn<ESM::Global>);
|
||||||
mGlobals.addColumn (new FixedRecordTypeColumn<ESM::Global> (UniversalId::Type_Global));
|
mGlobals.addColumn (new FixedRecordTypeColumn<ESM::Global> (UniversalId::Type_Global));
|
||||||
mGlobals.addColumn (new FloatValueColumn<ESM::Global>);
|
mGlobals.addColumn (new VarTypeColumn<ESM::Global> (ColumnBase::Display_GlobalVarType));
|
||||||
|
mGlobals.addColumn (new VarValueColumn<ESM::Global>);
|
||||||
|
|
||||||
mGmsts.addColumn (new StringIdColumn<ESM::GameSetting>);
|
mGmsts.addColumn (new StringIdColumn<ESM::GameSetting>);
|
||||||
mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>);
|
mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>);
|
||||||
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
||||||
mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting>);
|
mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting> (ColumnBase::Display_GmstVarType));
|
||||||
mGmsts.addColumn (new VarValueColumn<ESM::GameSetting>);
|
mGmsts.addColumn (new VarValueColumn<ESM::GameSetting>);
|
||||||
|
|
||||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
||||||
|
|
|
@ -35,8 +35,12 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
||||||
{
|
{
|
||||||
mDelegateFactories = new CSVWorld::CommandDelegateFactoryCollection;
|
mDelegateFactories = new CSVWorld::CommandDelegateFactoryCollection;
|
||||||
|
|
||||||
mDelegateFactories->add (CSMWorld::ColumnBase::Display_VarType,
|
mDelegateFactories->add (CSMWorld::ColumnBase::Display_GmstVarType,
|
||||||
new CSVWorld::VarTypeDelegateFactory (ESM::VT_None, ESM::VT_String, ESM::VT_Int, ESM::VT_Float));
|
new CSVWorld::VarTypeDelegateFactory (ESM::VT_None, ESM::VT_String, ESM::VT_Int, ESM::VT_Float));
|
||||||
|
|
||||||
|
mDelegateFactories->add (CSMWorld::ColumnBase::Display_GlobalVarType,
|
||||||
|
new CSVWorld::VarTypeDelegateFactory (ESM::VT_Short, ESM::VT_Long, ESM::VT_Float));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVDoc::ViewManager::~ViewManager()
|
CSVDoc::ViewManager::~ViewManager()
|
||||||
|
|
|
@ -85,7 +85,7 @@ void CSVWorld::VarTypeDelegateFactory::add (ESM::VarType type)
|
||||||
{
|
{
|
||||||
{ ESM::VT_None, "empty" },
|
{ ESM::VT_None, "empty" },
|
||||||
{ ESM::VT_Short, "short" },
|
{ ESM::VT_Short, "short" },
|
||||||
{ ESM::VT_Int, "long" },
|
{ ESM::VT_Int, "integer" },
|
||||||
{ ESM::VT_Long, "long" },
|
{ ESM::VT_Long, "long" },
|
||||||
{ ESM::VT_Float, "float" },
|
{ ESM::VT_Float, "float" },
|
||||||
{ ESM::VT_String, "string" },
|
{ ESM::VT_String, "string" },
|
||||||
|
|
Loading…
Reference in a new issue