1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 16:45:34 +00:00

Merge remote-tracking branch 'aesylwinn/FixNullGlobalVariable'

This commit is contained in:
Marc Zinnschlag 2016-08-09 10:17:26 +02:00
commit 96fd9263bf
4 changed files with 51 additions and 2 deletions

View file

@ -66,7 +66,7 @@ opencs_hdrs_noqt (view/doc
opencs_units (view/world opencs_units (view/world
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator globalcreator
cellcreator pathgridcreator referenceablecreator startscriptcreator referencecreator scenesubview cellcreator pathgridcreator referenceablecreator startscriptcreator referencecreator scenesubview
infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable
dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator dialoguespinbox recordbuttonbar tableeditidaction scripterrortable extendedcommandconfigurator

View file

@ -0,0 +1,26 @@
#include "globalcreator.hpp"
#include <components/esm/variant.hpp>
#include "../../model/world/data.hpp"
#include "../../model/world/commands.hpp"
#include "../../model/world/columns.hpp"
#include "../../model/world/idtable.hpp"
namespace CSVWorld
{
void GlobalCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const
{
CSMWorld::IdTable* table = static_cast<CSMWorld::IdTable*>(getData().getTableModel(getCollectionId()));
int index = table->findColumnIndex(CSMWorld::Columns::ColumnId_ValueType);
int type = (int)ESM::VT_Float;
command.addValue(index, type);
}
GlobalCreator::GlobalCreator(CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id)
: GenericCreator (data, undoStack, id, true)
{
}
}

View file

@ -0,0 +1,20 @@
#ifndef CSV_WORLD_GLOBALCREATOR_H
#define CSV_WORLD_GLOBALCREATOR_H
#include "genericcreator.hpp"
namespace CSVWorld
{
class GlobalCreator : public GenericCreator
{
public:
GlobalCreator(CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id);
protected:
virtual void configureCreateCommand(CSMWorld::CreateCommand& command) const;
};
}
#endif

View file

@ -7,6 +7,7 @@
#include "scriptsubview.hpp" #include "scriptsubview.hpp"
#include "regionmapsubview.hpp" #include "regionmapsubview.hpp"
#include "genericcreator.hpp" #include "genericcreator.hpp"
#include "globalcreator.hpp"
#include "cellcreator.hpp" #include "cellcreator.hpp"
#include "referenceablecreator.hpp" #include "referenceablecreator.hpp"
#include "referencecreator.hpp" #include "referencecreator.hpp"
@ -32,7 +33,6 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
static const CSMWorld::UniversalId::Type sTableTypes[] = static const CSMWorld::UniversalId::Type sTableTypes[] =
{ {
CSMWorld::UniversalId::Type_Globals,
CSMWorld::UniversalId::Type_Classes, CSMWorld::UniversalId::Type_Classes,
CSMWorld::UniversalId::Type_Factions, CSMWorld::UniversalId::Type_Factions,
CSMWorld::UniversalId::Type_Races, CSMWorld::UniversalId::Type_Races,
@ -78,6 +78,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
manager.add (CSMWorld::UniversalId::Type_Pathgrids, manager.add (CSMWorld::UniversalId::Type_Pathgrids,
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<PathgridCreator> >); new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<PathgridCreator> >);
manager.add (CSMWorld::UniversalId::Type_Globals,
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<GlobalCreator> >);
// Subviews for resources tables // Subviews for resources tables
manager.add (CSMWorld::UniversalId::Type_Meshes, manager.add (CSMWorld::UniversalId::Type_Meshes,
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>); new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);