1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-08 22:26:51 +02:00

map editor: fix resource reward in events

This commit is contained in:
godric3
2025-02-02 17:03:58 +01:00
parent ec5d4dbe5d
commit 61e5dbde20
2 changed files with 4 additions and 4 deletions

View File

@ -230,10 +230,10 @@ QVariantMap TownEventDialog::resourcesToVariant()
auto res = params.value("resources").toMap();
for (int i = 0; i < GameConstants::RESOURCE_QUANTITY; ++i)
{
auto * itemType = ui->resourcesTable->item(i, 0);
auto itemType = QString::fromStdString(GameConstants::RESOURCE_NAMES[i]);
auto * itemQty = static_cast<QSpinBox *> (ui->resourcesTable->cellWidget(i, 1));
res[itemType->text()] = QVariant::fromValue(itemQty->value());
res[itemType] = QVariant::fromValue(itemQty->value());
}
return res;
}

View File

@ -96,9 +96,9 @@ void TimedEvent::on_TimedEvent_finished(int result)
auto res = target->data(Qt::UserRole).toMap().value("resources").toMap();
for(int i = 0; i < GameConstants::RESOURCE_QUANTITY; ++i)
{
auto * itemType = ui->resources->item(i, 0);
auto itemType = QString::fromStdString(GameConstants::RESOURCE_NAMES[i]);
auto * itemQty = ui->resources->item(i, 1);
res[itemType->text()] = QVariant::fromValue(itemQty->text().toInt());
res[itemType] = QVariant::fromValue(itemQty->text().toInt());
}
descriptor["resources"] = res;