Skip to content

Commit

Permalink
Fix bug preventing adding new area
Browse files Browse the repository at this point in the history
  • Loading branch information
ExplosBlue committed Aug 6, 2023
1 parent 1500d0f commit c698d44
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions leveleditor/leveleditorwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,24 +630,24 @@ const int LevelEditorWindow::showSaveDialog()
return exitCode;
}

void LevelEditorWindow::on_actionAddArea_triggered()
{
void LevelEditorWindow::on_actionAddArea_triggered() {

if (status == EditorStatus::Unsaved || status == EditorStatus::SaveFailed) {
int exitCode = showSaveDialog();

if (exitCode != QMessageBox::Cancel)
{
if (lvlMgr->getAreaCount() >= 4)
{
QMessageBox::information(this, "CoinKiller", tr("Due to limitations there can only be a maximum of 4 areas in a level."), QMessageBox::Ok);
return;
}

int seekArea = lvlMgr->addArea(lvlMgr->getAreaCount());
loadArea(seekArea);
updateAreaSelector(seekArea);
if (exitCode == QMessageBox::Cancel) {
return;
}
}

if (lvlMgr->getAreaCount() >= 4) {
QMessageBox::information(this, "CoinKiller", tr("Due to limitations there can only be a maximum of 4 areas in a level."), QMessageBox::Ok);
return;
}

int seekArea = lvlMgr->addArea(lvlMgr->getAreaCount());
loadArea(seekArea);
updateAreaSelector(seekArea);
}

void LevelEditorWindow::on_actionDeleteCurrentArea_triggered()
Expand Down

0 comments on commit c698d44

Please sign in to comment.