handle un-numbered map groups when creating new maps

This commit is contained in:
garak 2019-05-20 22:33:28 -04:00
parent ef0b79d580
commit 24562fdaae

View file

@ -53,7 +53,7 @@ void NewMapPopup::setDefaultValues(int groupNum, QString mapSec) {
ui->comboBox_NewMap_Secondary_Tileset->addItems(tilesets.value("secondary"));
ui->comboBox_NewMap_Group->addItems(*project->groupNames);
ui->comboBox_NewMap_Group->setCurrentText("gMapGroup" + QString::number(groupNum));
ui->comboBox_NewMap_Group->setCurrentText(project->groupNames->at(groupNum));
if (existingLayout) {
ui->spinBox_NewMap_Width->setValue(project->mapLayouts.value(layoutId)->width.toInt(nullptr, 0));
@ -151,7 +151,7 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
newMap->allowEscapeRope = this->ui->checkBox_NewMap_Allow_Escape_Rope->isChecked() ? "1" : "0";
}
group = this->ui->comboBox_NewMap_Group->currentText().remove("gMapGroup").toInt();
group = project->groupNames->indexOf(this->ui->comboBox_NewMap_Group->currentText());
newMap->layout = layout;
newMap->layoutId = layout->id;
project->loadMapLayout(newMap);