mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Compile map editor
This commit is contained in:
@@ -531,7 +531,7 @@ void Inspector::setProperty(CGPandoraBox * o, const QString & key, const QVarian
|
||||
if(!o) return;
|
||||
|
||||
if(key == "Message")
|
||||
o->message = value.toString().toStdString();
|
||||
o->message.appendRawString(value.toString().toStdString());
|
||||
}
|
||||
|
||||
void Inspector::setProperty(CGEvent * o, const QString & key, const QVariant & value)
|
||||
@@ -561,7 +561,7 @@ void Inspector::setProperty(CGSignBottle * o, const QString & key, const QVarian
|
||||
if(!o) return;
|
||||
|
||||
if(key == "Message")
|
||||
o->message = value.toString().toStdString();
|
||||
o->message.appendRawString(value.toString().toStdString());
|
||||
}
|
||||
|
||||
void Inspector::setProperty(CGMine * o, const QString & key, const QVariant & value)
|
||||
@@ -577,7 +577,7 @@ void Inspector::setProperty(CGArtifact * o, const QString & key, const QVariant
|
||||
if(!o) return;
|
||||
|
||||
if(key == "Message")
|
||||
o->message = value.toString().toStdString();
|
||||
o->message.appendRawString(value.toString().toStdString());
|
||||
|
||||
if(o->storedArtifact && key == "Spell")
|
||||
{
|
||||
@@ -643,7 +643,7 @@ void Inspector::setProperty(CGCreature * o, const QString & key, const QVariant
|
||||
if(!o) return;
|
||||
|
||||
if(key == "Message")
|
||||
o->message = value.toString().toStdString();
|
||||
o->message.appendRawString(value.toString().toStdString());
|
||||
if(key == "Character")
|
||||
o->character = CGCreature::Character(value.toInt());
|
||||
if(key == "Never flees")
|
||||
@@ -661,11 +661,11 @@ void Inspector::setProperty(CGSeerHut * o, const QString & key, const QVariant &
|
||||
if(key == "Mission type")
|
||||
o->quest->missionType = CQuest::Emission(value.toInt());
|
||||
if(key == "First visit text")
|
||||
o->quest->firstVisitText = value.toString().toStdString();
|
||||
o->quest->firstVisitText.appendRawString(value.toString().toStdString());
|
||||
if(key == "Next visit text")
|
||||
o->quest->nextVisitText = value.toString().toStdString();
|
||||
o->quest->nextVisitText.appendRawString(value.toString().toStdString());
|
||||
if(key == "Completed text")
|
||||
o->quest->completedText = value.toString().toStdString();
|
||||
o->quest->completedText.appendRawString(value.toString().toStdString());
|
||||
}
|
||||
|
||||
|
||||
@@ -713,6 +713,11 @@ QTableWidgetItem * Inspector::addProperty(const std::string & value)
|
||||
return addProperty(QString::fromStdString(value));
|
||||
}
|
||||
|
||||
QTableWidgetItem * Inspector::addProperty(const MetaString & value)
|
||||
{
|
||||
return addProperty(value.toString());
|
||||
}
|
||||
|
||||
QTableWidgetItem * Inspector::addProperty(const QString & value)
|
||||
{
|
||||
auto * item = new QTableWidgetItem(value);
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "../lib/mapObjects/MapObjects.h"
|
||||
#include "../lib/mapObjects/CRewardableObject.h"
|
||||
#include "../lib/ResourceSet.h"
|
||||
#include "../lib/MetaString.h"
|
||||
|
||||
#define DECLARE_OBJ_TYPE(x) void initialize(x*);
|
||||
#define DECLARE_OBJ_PROPERTY_METHODS(x) \
|
||||
@@ -83,6 +84,7 @@ protected:
|
||||
//===============DECLARE PROPERTY VALUE TYPE==============================
|
||||
QTableWidgetItem * addProperty(unsigned int value);
|
||||
QTableWidgetItem * addProperty(int value);
|
||||
QTableWidgetItem * addProperty(const MetaString & value);
|
||||
QTableWidgetItem * addProperty(const std::string & value);
|
||||
QTableWidgetItem * addProperty(const QString & value);
|
||||
QTableWidgetItem * addProperty(const int3 & value);
|
||||
|
@@ -37,7 +37,7 @@ QVariant toVariant(const CMapEvent & event)
|
||||
{
|
||||
QVariantMap result;
|
||||
result["name"] = QString::fromStdString(event.name);
|
||||
result["message"] = QString::fromStdString(event.message);
|
||||
result["message"] = QString::fromStdString(event.message.toString());
|
||||
result["players"] = QVariant::fromValue(event.players);
|
||||
result["humanAffected"] = QVariant::fromValue(event.humanAffected);
|
||||
result["computerAffected"] = QVariant::fromValue(event.computerAffected);
|
||||
@@ -52,7 +52,7 @@ CMapEvent eventFromVariant(const QVariant & variant)
|
||||
CMapEvent result;
|
||||
auto v = variant.toMap();
|
||||
result.name = v.value("name").toString().toStdString();
|
||||
result.message = v.value("message").toString().toStdString();
|
||||
result.message.appendRawString(v.value("message").toString().toStdString());
|
||||
result.players = v.value("players").toInt();
|
||||
result.humanAffected = v.value("humanAffected").toInt();
|
||||
result.computerAffected = v.value("computerAffected").toInt();
|
||||
|
@@ -27,8 +27,8 @@ GeneralSettings::~GeneralSettings()
|
||||
void GeneralSettings::initialize(MapController & c)
|
||||
{
|
||||
AbstractSettings::initialize(c);
|
||||
ui->mapNameEdit->setText(tr(controller->map()->name.c_str()));
|
||||
ui->mapDescriptionEdit->setPlainText(tr(controller->map()->description.c_str()));
|
||||
ui->mapNameEdit->setText(QString::fromStdString(controller->map()->name.toString()));
|
||||
ui->mapDescriptionEdit->setPlainText(QString::fromStdString(controller->map()->description.toString()));
|
||||
ui->heroLevelLimit->setValue(controller->map()->levelLimit);
|
||||
ui->heroLevelLimitCheck->setChecked(controller->map()->levelLimit);
|
||||
|
||||
@@ -59,8 +59,8 @@ void GeneralSettings::initialize(MapController & c)
|
||||
|
||||
void GeneralSettings::update()
|
||||
{
|
||||
controller->map()->name = ui->mapNameEdit->text().toStdString();
|
||||
controller->map()->description = ui->mapDescriptionEdit->toPlainText().toStdString();
|
||||
controller->map()->name.appendRawString(ui->mapNameEdit->text().toStdString());
|
||||
controller->map()->description.appendRawString(ui->mapDescriptionEdit->toPlainText().toStdString());
|
||||
if(ui->heroLevelLimitCheck->isChecked())
|
||||
controller->map()->levelLimit = ui->heroLevelLimit->value();
|
||||
else
|
||||
|
@@ -30,7 +30,7 @@ void RumorSettings::initialize(MapController & c)
|
||||
for(auto & rumor : controller->map()->rumors)
|
||||
{
|
||||
auto * item = new QListWidgetItem(QString::fromStdString(rumor.name));
|
||||
item->setData(Qt::UserRole, QVariant(QString::fromStdString(rumor.text)));
|
||||
item->setData(Qt::UserRole, QVariant(QString::fromStdString(rumor.text.toString())));
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
ui->rumors->addItem(item);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void RumorSettings::update()
|
||||
{
|
||||
Rumor rumor;
|
||||
rumor.name = ui->rumors->item(i)->text().toStdString();
|
||||
rumor.text = ui->rumors->item(i)->data(Qt::UserRole).toString().toStdString();
|
||||
rumor.text.appendRawString(ui->rumors->item(i)->data(Qt::UserRole).toString().toStdString());
|
||||
controller->map()->rumors.push_back(rumor);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user