mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:23:54 +00:00
added basic region table
This commit is contained in:
parent
ff1d908af4
commit
e25f5c6dfe
9 changed files with 58 additions and 4 deletions
|
@ -87,6 +87,10 @@ CSMWorld::Data::Data()
|
||||||
mScripts.addColumn (new StringIdColumn<ESM::Script>);
|
mScripts.addColumn (new StringIdColumn<ESM::Script>);
|
||||||
mScripts.addColumn (new RecordStateColumn<ESM::Script>);
|
mScripts.addColumn (new RecordStateColumn<ESM::Script>);
|
||||||
|
|
||||||
|
mRegions.addColumn (new StringIdColumn<ESM::Region>);
|
||||||
|
mRegions.addColumn (new RecordStateColumn<ESM::Region>);
|
||||||
|
mRegions.addColumn (new NameColumn<ESM::Region>);
|
||||||
|
|
||||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
||||||
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);
|
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);
|
||||||
addModel (new IdTable (&mSkills), UniversalId::Type_Skills, UniversalId::Type_Skill);
|
addModel (new IdTable (&mSkills), UniversalId::Type_Skills, UniversalId::Type_Skill);
|
||||||
|
@ -95,6 +99,7 @@ CSMWorld::Data::Data()
|
||||||
addModel (new IdTable (&mRaces), UniversalId::Type_Races, UniversalId::Type_Race);
|
addModel (new IdTable (&mRaces), UniversalId::Type_Races, UniversalId::Type_Race);
|
||||||
addModel (new IdTable (&mSounds), UniversalId::Type_Sounds, UniversalId::Type_Sound);
|
addModel (new IdTable (&mSounds), UniversalId::Type_Sounds, UniversalId::Type_Sound);
|
||||||
addModel (new IdTable (&mScripts), UniversalId::Type_Scripts, UniversalId::Type_Script);
|
addModel (new IdTable (&mScripts), UniversalId::Type_Scripts, UniversalId::Type_Script);
|
||||||
|
addModel (new IdTable (&mRegions), UniversalId::Type_Regions, UniversalId::Type_Region);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMWorld::Data::~Data()
|
CSMWorld::Data::~Data()
|
||||||
|
@ -183,6 +188,16 @@ CSMWorld::IdCollection<ESM::Script>& CSMWorld::Data::getScripts()
|
||||||
return mScripts;
|
return mScripts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CSMWorld::IdCollection<ESM::Region>& CSMWorld::Data::getRegions() const
|
||||||
|
{
|
||||||
|
return mRegions;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSMWorld::IdCollection<ESM::Region>& CSMWorld::Data::getRegions()
|
||||||
|
{
|
||||||
|
return mRegions;
|
||||||
|
}
|
||||||
|
|
||||||
QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id)
|
QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id)
|
||||||
{
|
{
|
||||||
std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType());
|
std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType());
|
||||||
|
@ -225,6 +240,7 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
||||||
case ESM::REC_RACE: mRaces.load (reader, base); break;
|
case ESM::REC_RACE: mRaces.load (reader, base); break;
|
||||||
case ESM::REC_SOUN: mSounds.load (reader, base); break;
|
case ESM::REC_SOUN: mSounds.load (reader, base); break;
|
||||||
case ESM::REC_SCPT: mScripts.load (reader, base); break;
|
case ESM::REC_SCPT: mScripts.load (reader, base); break;
|
||||||
|
case ESM::REC_REGN: mRegions.load (reader, base); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <components/esm/loadrace.hpp>
|
#include <components/esm/loadrace.hpp>
|
||||||
#include <components/esm/loadsoun.hpp>
|
#include <components/esm/loadsoun.hpp>
|
||||||
#include <components/esm/loadscpt.hpp>
|
#include <components/esm/loadscpt.hpp>
|
||||||
|
#include <components/esm/loadregn.hpp>
|
||||||
|
|
||||||
#include "idcollection.hpp"
|
#include "idcollection.hpp"
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
|
@ -32,6 +33,7 @@ namespace CSMWorld
|
||||||
IdCollection<ESM::Race> mRaces;
|
IdCollection<ESM::Race> mRaces;
|
||||||
IdCollection<ESM::Sound> mSounds;
|
IdCollection<ESM::Sound> mSounds;
|
||||||
IdCollection<ESM::Script> mScripts;
|
IdCollection<ESM::Script> mScripts;
|
||||||
|
IdCollection<ESM::Region> mRegions;
|
||||||
std::vector<QAbstractItemModel *> mModels;
|
std::vector<QAbstractItemModel *> mModels;
|
||||||
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
||||||
|
|
||||||
|
@ -80,6 +82,10 @@ namespace CSMWorld
|
||||||
|
|
||||||
IdCollection<ESM::Script>& getScripts();
|
IdCollection<ESM::Script>& getScripts();
|
||||||
|
|
||||||
|
const IdCollection<ESM::Region>& getRegions() const;
|
||||||
|
|
||||||
|
IdCollection<ESM::Region>& getRegions();
|
||||||
|
|
||||||
QAbstractItemModel *getTableModel (const UniversalId& id);
|
QAbstractItemModel *getTableModel (const UniversalId& id);
|
||||||
///< If no table model is available for \a id, an exception is thrown.
|
///< If no table model is available for \a id, an exception is thrown.
|
||||||
///
|
///
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace
|
||||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Races, "Races" },
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Races, "Races" },
|
||||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Sounds, "Sounds" },
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Sounds, "Sounds" },
|
||||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Scripts, "Scripts" },
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Scripts, "Scripts" },
|
||||||
|
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Regions, "Regions" },
|
||||||
|
|
||||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
||||||
};
|
};
|
||||||
|
@ -39,6 +40,7 @@ namespace
|
||||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Race, "Race" },
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Race, "Race" },
|
||||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Sound, "Sound" },
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Sound, "Sound" },
|
||||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Script, "Script" },
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Script, "Script" },
|
||||||
|
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Region, "Region" },
|
||||||
|
|
||||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,9 @@ namespace CSMWorld
|
||||||
Type_Sounds,
|
Type_Sounds,
|
||||||
Type_Sound,
|
Type_Sound,
|
||||||
Type_Scripts,
|
Type_Scripts,
|
||||||
Type_Script
|
Type_Script,
|
||||||
|
Type_Regions,
|
||||||
|
Type_Region
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -113,6 +113,10 @@ void CSVDoc::View::setupWorldMenu()
|
||||||
QAction *scripts = new QAction (tr ("Scripts"), this);
|
QAction *scripts = new QAction (tr ("Scripts"), this);
|
||||||
connect (scripts, SIGNAL (triggered()), this, SLOT (addScriptsSubView()));
|
connect (scripts, SIGNAL (triggered()), this, SLOT (addScriptsSubView()));
|
||||||
world->addAction (scripts);
|
world->addAction (scripts);
|
||||||
|
|
||||||
|
QAction *regions = new QAction (tr ("Regions"), this);
|
||||||
|
connect (regions, SIGNAL (triggered()), this, SLOT (addRegionsSubView()));
|
||||||
|
world->addAction (regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::View::setupUi()
|
void CSVDoc::View::setupUi()
|
||||||
|
@ -298,6 +302,11 @@ void CSVDoc::View::addScriptsSubView()
|
||||||
addSubView (CSMWorld::UniversalId::Type_Scripts);
|
addSubView (CSMWorld::UniversalId::Type_Scripts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::View::addRegionsSubView()
|
||||||
|
{
|
||||||
|
addSubView (CSMWorld::UniversalId::Type_Regions);
|
||||||
|
}
|
||||||
|
|
||||||
void CSVDoc::View::abortOperation (int type)
|
void CSVDoc::View::abortOperation (int type)
|
||||||
{
|
{
|
||||||
mDocument->abortOperation (type);
|
mDocument->abortOperation (type);
|
||||||
|
|
|
@ -127,6 +127,8 @@ namespace CSVDoc
|
||||||
void addSoundsSubView();
|
void addSoundsSubView();
|
||||||
|
|
||||||
void addScriptsSubView();
|
void addScriptsSubView();
|
||||||
|
|
||||||
|
void addRegionsSubView();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
||||||
CSMWorld::UniversalId::Type_Races,
|
CSMWorld::UniversalId::Type_Races,
|
||||||
CSMWorld::UniversalId::Type_Sounds,
|
CSMWorld::UniversalId::Type_Sounds,
|
||||||
CSMWorld::UniversalId::Type_Scripts,
|
CSMWorld::UniversalId::Type_Scripts,
|
||||||
|
CSMWorld::UniversalId::Type_Regions,
|
||||||
|
|
||||||
CSMWorld::UniversalId::Type_None // end marker
|
CSMWorld::UniversalId::Type_None // end marker
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,4 +46,17 @@ void Region::save(ESMWriter &esm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Region::blank()
|
||||||
|
{
|
||||||
|
mName.clear();
|
||||||
|
|
||||||
|
mData.mClear = mData.mCloudy = mData.mFoggy = mData.mOvercast = mData.mRain =
|
||||||
|
mData.mThunder = mData.mAsh, mData.mBlight = mData.mA = mData.mB = 0;
|
||||||
|
|
||||||
|
mMapColor = 0;
|
||||||
|
|
||||||
|
mName.clear();
|
||||||
|
mSleepList.clear();
|
||||||
|
mSoundList.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,9 @@ struct Region
|
||||||
|
|
||||||
void load(ESMReader &esm);
|
void load(ESMReader &esm);
|
||||||
void save(ESMWriter &esm);
|
void save(ESMWriter &esm);
|
||||||
|
|
||||||
|
void blank();
|
||||||
|
///< Set record to default state (does not touch the ID/index).
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue