fix bugs in wavetracewhen building towers

fix some bugs in ADeditor
This commit is contained in:
2010-09-01 21:50:30 +04:00
parent 3316f3f48f
commit 7752f7be12
12 changed files with 605 additions and 296 deletions

View File

@@ -218,6 +218,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
switch (ret)
{
case QMessageBox::Save :
adloader->save("data2.xml");
adloader->load("data2.xml");
adloader->save("data2.xml");
event->accept();
break;
@@ -364,6 +366,17 @@ void MainWindow::on_pbAlDel_clicked()
if (adloader->aliens.size() < 2) return;
QMessageBox msgBox;
int id = adloader->aliens.keys().at(ui->lvAliens->currentIndex().row());
for (int i=0; i<adloader->waveParts.size(); i++)
{
if (adloader->waveParts.values().at(i).alienId == id)
{
msgBox.setText(tr("You can not delete alien %1 id=%2").arg(adloader->aliens.value(id).name).arg(id));
msgBox.setInformativeText(tr("It used in wawe %1").arg(adloader->waveParts.values().at(i).waveId));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
}
}
msgBox.setText(tr("Delete alien %1 id=%2").arg(adloader->aliens.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
@@ -514,6 +527,17 @@ void MainWindow::on_pbTwDel_clicked()
if (adloader->towers.size() < 2) return;
QMessageBox msgBox;
int id = adloader->towers.keys().at(ui->lvTowers->currentIndex().row());
for (int i=0; i<adloader->levTowers.size(); i++)
{
if (adloader->levTowers.values().at(i).towerId == id)
{
msgBox.setText(tr("You can not delete tower %1 id=%2").arg(adloader->towers.value(id).name).arg(id));
msgBox.setInformativeText(tr("It used in level %1").arg(adloader->levTowers.values().at(i).levelId));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
}
}
msgBox.setText(tr("Delete tower %1 id=%2").arg(adloader->towers.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
@@ -585,6 +609,7 @@ void MainWindow::on_pbSplAdd_clicked()
}
void MainWindow::on_pbSlpDel_clicked()
{
if (adloader->splashes.size() < 2) return;
@@ -595,7 +620,19 @@ void MainWindow::on_pbSlpDel_clicked()
if (adloader->towers.values().at(i).splashId == id)
{
msgBox.setText(tr("You can not delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id));
msgBox.setInformativeText(tr("It used by tower %1").arg(adloader->towers.values().at(i).name));
msgBox.setInformativeText(tr("It used by tower %1 id=%2").arg(adloader->towers.values().at(i).name).arg(adloader->towers.values().at(i).id));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
}
}
for (int i=0; i<adloader->chains.size(); i++)
{
if (adloader->chains.values().at(i).childSplashId == id
|| adloader->chains.values().at(i).parentSplashId == id)
{
msgBox.setText(tr("You can not delete splash %1 id=%2").arg(adloader->splashes.value(id).name).arg(id));
msgBox.setInformativeText(tr("It used by chain in tower %1 id=%2").arg(adloader->towers.value(adloader->chains.values().at(i).towerId).name).arg(adloader->chains.values().at(i).towerId));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
@@ -774,6 +811,17 @@ void MainWindow::on_pbTrigDel_clicked()
if (adloader->triggers.size() < 2) return;
QMessageBox msgBox;
int id = adloader->triggers.keys().at(ui->lvTriggers->currentIndex().row());
for (int i=0; i<adloader->chains.size(); i++)
{
if (adloader->chains.values().at(i).triggerId == id)
{
msgBox.setText(tr("You can not delete trigger %1 id=%2").arg(adloader->triggers.value(id).name).arg(id));
msgBox.setInformativeText(tr("It used by chain in tower %1 id=%2").arg(adloader->towers.value(adloader->chains.values().at(i).towerId).name).arg(adloader->chains.values().at(i).towerId));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return;
}
}
msgBox.setText(tr("Delete trigger %1 id=%2").arg(adloader->triggers.value(id).name).arg(id));
msgBox.setInformativeText(tr("Are you sure?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);