mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 16:20:21 +00:00
saving progress
This commit is contained in:
parent
6a9c7c9f86
commit
13ee469b70
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
@ -2221,8 +2222,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||||||
boost::filesystem::path customFiltersPath (configuration.getUserDataPath());
|
boost::filesystem::path customFiltersPath (configuration.getUserDataPath());
|
||||||
customFiltersPath /= "defaultfilters";
|
customFiltersPath /= "defaultfilters";
|
||||||
|
|
||||||
std::string destinationPath = mProjectPath.string() + "/defaultfilters";
|
std::ofstream dst(mProjectPath.c_str(), std::ios::binary);
|
||||||
std::ofstream dst(destinationPath.c_str(), std::ios::binary);
|
|
||||||
|
|
||||||
if (boost::filesystem::exists (customFiltersPath))
|
if (boost::filesystem::exists (customFiltersPath))
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ namespace CSMWorld
|
|||||||
{ ColumnId_ValueType, "Value Type" },
|
{ ColumnId_ValueType, "Value Type" },
|
||||||
{ ColumnId_Description, "Description" },
|
{ ColumnId_Description, "Description" },
|
||||||
{ ColumnId_Specialisation, "Specialisation" },
|
{ ColumnId_Specialisation, "Specialisation" },
|
||||||
|
{ ColumnId_Skill, "Skill" },
|
||||||
{ ColumnId_Attribute, "Attribute" },
|
{ ColumnId_Attribute, "Attribute" },
|
||||||
{ ColumnId_Name, "Name" },
|
{ ColumnId_Name, "Name" },
|
||||||
{ ColumnId_Playable, "Playable" },
|
{ ColumnId_Playable, "Playable" },
|
||||||
@ -248,6 +249,11 @@ int CSMWorld::Columns::getId (const std::string& name)
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
static const char *sSkills[] =
|
||||||
|
{
|
||||||
|
"Long Blade"
|
||||||
|
};
|
||||||
|
|
||||||
static const char *sSpecialisations[] =
|
static const char *sSpecialisations[] =
|
||||||
{
|
{
|
||||||
"Combat", "Magic", "Stealth", 0
|
"Combat", "Magic", "Stealth", 0
|
||||||
@ -339,6 +345,7 @@ namespace
|
|||||||
switch (column)
|
switch (column)
|
||||||
{
|
{
|
||||||
case CSMWorld::Columns::ColumnId_Specialisation: return sSpecialisations;
|
case CSMWorld::Columns::ColumnId_Specialisation: return sSpecialisations;
|
||||||
|
case CSMWorld::Columns::ColumnId_Skill: return sSkills;
|
||||||
case CSMWorld::Columns::ColumnId_Attribute: return sAttributes;
|
case CSMWorld::Columns::ColumnId_Attribute: return sAttributes;
|
||||||
case CSMWorld::Columns::ColumnId_SpellType: return sSpellTypes;
|
case CSMWorld::Columns::ColumnId_SpellType: return sSpellTypes;
|
||||||
case CSMWorld::Columns::ColumnId_ApparatusType: return sApparatusTypes;
|
case CSMWorld::Columns::ColumnId_ApparatusType: return sApparatusTypes;
|
||||||
|
@ -190,6 +190,7 @@ namespace CSMWorld
|
|||||||
ColumnId_RotY = 175,
|
ColumnId_RotY = 175,
|
||||||
ColumnId_RotZ = 176,
|
ColumnId_RotZ = 176,
|
||||||
ColumnId_DestinationCell = 177,
|
ColumnId_DestinationCell = 177,
|
||||||
|
ColumnId_Skill = 178,
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -173,13 +173,17 @@ void CSMWorld::CloneCommand::undo()
|
|||||||
mModel.removeRow (mModel.getModelIndex (mIdDestination, 0).row());
|
mModel.removeRow (mModel.getModelIndex (mIdDestination, 0).row());
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMWorld::DeleteNestedCommand::DeleteNestedCommand (IdTable& model, const std::string& id, int nestedRow, int parentColumn, QUndoCommand* parent)
|
CSMWorld::DeleteNestedCommand::DeleteNestedCommand (IdTable& model,
|
||||||
: mId(id),
|
const std::string& id,
|
||||||
mModel(model),
|
int nestedRow,
|
||||||
mParentColumn(parentColumn),
|
int parentColumn,
|
||||||
QUndoCommand(parent),
|
QUndoCommand* parent) :
|
||||||
mNestedRow(nestedRow),
|
mId(id),
|
||||||
NestedTableStoring(model, id, parentColumn)
|
mModel(model),
|
||||||
|
mParentColumn(parentColumn),
|
||||||
|
QUndoCommand(parent),
|
||||||
|
mNestedRow(nestedRow),
|
||||||
|
NestedTableStoring(model, id, parentColumn)
|
||||||
{
|
{
|
||||||
setText (("Delete nested row in " + mId).c_str());
|
setText (("Delete nested row in " + mId).c_str());
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
#include <components/esm/loadcont.hpp>
|
#include <components/esm/loadcont.hpp>
|
||||||
#include <components/esm/defs.hpp>
|
#include <components/esm/defs.hpp>
|
||||||
#include <components/esm/loadnpc.hpp>
|
#include <components/esm/loadnpc.hpp>
|
||||||
|
#include <components/esm/loadspel.hpp>
|
||||||
|
#include <components/esm/effectlist.hpp>
|
||||||
|
#include <components/esm/loadmgef.hpp>
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
@ -174,6 +177,129 @@ namespace CSMWorld
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
template <typename ESXRecordT>
|
||||||
|
class MagicEffectsHelper : public CastableHelper<ESXRecordT>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
MagicEffectsHelper(CSMWorld::UniversalId::Type type)
|
||||||
|
: CastableHelper<ESXRecordT>(type) {}
|
||||||
|
|
||||||
|
virtual void setNestedTable(RefIdData& data,
|
||||||
|
int index,
|
||||||
|
const NestedTableWrapperBase& nestedTable)
|
||||||
|
{
|
||||||
|
CastableHelper<ESXRecordT>::getRecord(data, index).get().mEffects =
|
||||||
|
(static_cast<const NestedTableWrapper<ESM::EffectList>&>(nestedTable)).mNestedTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual NestedTableWrapperBase* nestedTable(const RefIdData& data,
|
||||||
|
int index) const
|
||||||
|
{
|
||||||
|
return new NestedTableWrapper<ESM::EffectList>(CastableHelper<ESXRecordT>::getRecord(data, index).get().mEffects);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual QVariant getNestedData(const CSMWorld::RefIdData& data,
|
||||||
|
int index,
|
||||||
|
int subRowIndex,
|
||||||
|
int subColIndex) const
|
||||||
|
{
|
||||||
|
const ESM::EffectList& content = CastableHelper<ESXRecordT>::getRecord(data, index).get().mEffects;
|
||||||
|
|
||||||
|
switch (subColIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return content.at(subRowIndex).mEffectID;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return content.at(subRowIndex).mRange;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return content.at(subRowIndex).mDuration;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
return content.at(subRowIndex).mArea;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
return content.at(subRowIndex).mMagMin;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
return content.at(subRowIndex).mMagMax;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
return (int)content.at(rubRowIndex).mSkill;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
return (int)content.at(subRowIndex).mAttribute;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw std::logic_error("Trying to access non-existing column in the nested table!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void removeNestedRow (RefIdData& data, int index, int rowToRemove) const
|
||||||
|
{
|
||||||
|
ESM::EffectList& list = CastableHelper<ESXRecordT>::getRecord(data, index).get().mEffects;
|
||||||
|
|
||||||
|
list.erase (list.begin () + rowToRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setNestedData (RefIdData& data,
|
||||||
|
int index,
|
||||||
|
const QVariant& value,
|
||||||
|
int subRowIndex,
|
||||||
|
int subColIndex) const
|
||||||
|
{
|
||||||
|
switch(subColIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
CastableHelper<ESXRecordT>::getRecord(data, index).get().mEffects.at(subRowIndex).mEffectID = value.toInt();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw std::logic_error("Trying to access non-existing column in the nested table!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void addNestedRow (RefIdData& data, int index, int position) const
|
||||||
|
{
|
||||||
|
std::vector<ESM::NPC::Dest>& list = CastableHelper<ESXRecordT>::getRecord(data, index).get().mTransport;
|
||||||
|
|
||||||
|
ESM::Position newPos;
|
||||||
|
for (unsigned i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
newPos.pos[i] = 0;
|
||||||
|
newPos.rot[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESM::NPC::Dest newRow;
|
||||||
|
newRow.mPos = newPos;
|
||||||
|
newRow.mCellName = "";
|
||||||
|
|
||||||
|
if (position >= (int)list.size())
|
||||||
|
{
|
||||||
|
list.push_back(newRow);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.insert(list.begin()+position, newRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int getNestedColumnsCount(const RefIdData& data) const
|
||||||
|
{
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual int getNestedRowsCount(const RefIdData& data,
|
||||||
|
int index) const
|
||||||
|
{
|
||||||
|
return CastableHelper<ESXRecordT>::getRecord(data, index).get().mTransport.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
*/
|
||||||
template <typename ESXRecordT>
|
template <typename ESXRecordT>
|
||||||
class DestinationsHelper : public CastableHelper<ESXRecordT>
|
class DestinationsHelper : public CastableHelper<ESXRecordT>
|
||||||
{
|
{
|
||||||
@ -316,7 +442,7 @@ namespace CSMWorld
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename ESXRecordT>
|
template <typename ESXRecordT>
|
||||||
class InventoryHelper : public CastableHelper<ESXRecordT>
|
class InventoryHelper : public CastableHelper<ESXRecordT>
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,6 @@ QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent,
|
|||||||
const QModelIndex& index) const
|
const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
return createEditor(parent, option, index, CSMWorld::ColumnBase::Display_None);
|
return createEditor(parent, option, index, CSMWorld::ColumnBase::Display_None);
|
||||||
//overloading virtual functions is HARD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option,
|
QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user