diff --git a/mapeditor/inspector.cpp b/mapeditor/inspector.cpp
index 9e7b96675..bb7f98075 100644
--- a/mapeditor/inspector.cpp
+++ b/mapeditor/inspector.cpp
@@ -123,7 +123,7 @@ void Inspector::updateProperties(CArmedInstance * o)
{
if(!o) return;
- auto * delegate = new InspectorDelegate;
+ auto * delegate = new InspectorDelegate();
delegate->options << "NEUTRAL";
for(int p = 0; p < map->players.size(); ++p)
if(map->players[p].canAnyonePlay())
@@ -170,6 +170,24 @@ void Inspector::updateProperties(CGTownInstance * o)
void Inspector::updateProperties(CGArtifact * o)
{
if(!o) return;
+
+ addProperty("Message", o->message, false);
+
+ CArtifactInstance * instance = o->storedArtifact;
+ if(instance)
+ {
+ SpellID spellId = instance->getGivenSpellID();
+ if(spellId != -1)
+ {
+ auto * delegate = new InspectorDelegate;
+ for(auto spell : VLC->spellh->objects)
+ {
+ //if(map->isAllowedSpell(spell->id))
+ delegate->options << QString::fromStdString(spell->name);
+ }
+ addProperty("Spell", VLC->spellh->objects[spellId]->name, delegate, false);
+ }
+ }
}
void Inspector::updateProperties(CGMine * o)
@@ -186,6 +204,7 @@ void Inspector::updateProperties(CGResource * o)
if(!o) return;
addProperty("Amount", o->amount, false);
+ addProperty("Message", o->message, false);
}
void Inspector::updateProperties(CGCreature * o)
@@ -286,6 +305,21 @@ void Inspector::setProperty(CGMine * object, const QString & key, const QVariant
void Inspector::setProperty(CGArtifact * object, const QString & key, const QVariant & value)
{
if(!object) return;
+
+ if(key == "Message")
+ object->message = value.toString().toStdString();
+
+ if(object->storedArtifact && key == "Spell")
+ {
+ for(auto spell : VLC->spellh->objects)
+ {
+ if(spell->name == value.toString().toStdString())
+ {
+ object->storedArtifact = CArtifactInstance::createScroll(spell->getId());
+ break;
+ }
+ }
+ }
}
void Inspector::setProperty(CGDwelling * object, const QString & key, const QVariant & value)
diff --git a/mapeditor/inspector.h b/mapeditor/inspector.h
index 5e9b4b20e..b98365d38 100644
--- a/mapeditor/inspector.h
+++ b/mapeditor/inspector.h
@@ -131,8 +131,6 @@ class InspectorDelegate : public QStyledItemDelegate
public:
static InspectorDelegate * boolDelegate();
- InspectorDelegate(const QStringList &);
-
using QStyledItemDelegate::QStyledItemDelegate;
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
diff --git a/mapeditor/mainwindow.ui b/mapeditor/mainwindow.ui
index 73464d754..447fa2b50 100644
--- a/mapeditor/mainwindow.ui
+++ b/mapeditor/mainwindow.ui
@@ -197,13 +197,13 @@
- 192
+ 268
196
- 192
+ 524287
524287
@@ -344,7 +344,7 @@
- QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked
+ QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked
QAbstractItemView::SingleSelection
@@ -668,7 +668,7 @@
0
0
128
- 344
+ 271
@@ -711,7 +711,7 @@
0
0
128
- 344
+ 271
@@ -730,7 +730,7 @@
0
0
128
- 344
+ 271