diff --git a/ADeditor/ADeditor b/ADeditor/ADeditor deleted file mode 100755 index 1f540c6..0000000 Binary files a/ADeditor/ADeditor and /dev/null differ diff --git a/ADeditor/ADeditor.pro.user b/ADeditor/ADeditor.pro.user index a9301bc..8049e5d 100644 --- a/ADeditor/ADeditor.pro.user +++ b/ADeditor/ADeditor.pro.user @@ -1,111 +1,241 @@ - ProjectExplorer.Project.ActiveTarget + RunConfiguration0-BaseEnvironmentBase + 2 + + + RunConfiguration0-CommandLineArguments + + + + RunConfiguration0-ProFile + ADeditor.pro + + + RunConfiguration0-RunConfiguration.name + ADeditor + + + RunConfiguration0-UseDyldImageSuffix + false + + + RunConfiguration0-UseTerminal + false + + + RunConfiguration0-UserEnvironmentChanges + + + + RunConfiguration0-UserSetName + false + + + RunConfiguration0-UserSetWorkingDirectory + true + + + RunConfiguration0-UserWorkingDirectory + /home/andrey/AD/aliendefender + + + RunConfiguration0-type + Qt4ProjectManager.Qt4RunConfiguration + + + activeRunConfiguration 0 - ProjectExplorer.Project.EditorSettings + activebuildconfiguration + Debug + + + buildConfiguration-Debug - System + Debug + 0 + 0 + 2 - ProjectExplorer.Project.Target.0 + buildConfiguration-Release - Настольный компьютер - Qt4ProjectManager.Target.DesktopTarget - 1 - 0 - - - - QtProjectManager.QMakeBuildStep - - - - - Qt4ProjectManager.MakeStep - false - - - - 2 - - - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - C:/Users/Andrey/Desktop/build-ADeditor - 9 - 2 - true - - - - - QtProjectManager.QMakeBuildStep - - - - - Qt4ProjectManager.MakeStep - false - - - - 2 - - - Qt4ProjectManager.MakeStep - true - - - - 1 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - C:/Users/Andrey/Desktop/build-AD - 9 - 2 - true - - 2 - - ADeditor - Qt4ProjectManager.Qt4RunConfiguration - 2 - - ADeditor.pro - false - false - - false - true - C:\Users\Andrey\Desktop\aliendefender - - 1 + Release + 0 + 0 - ProjectExplorer.Project.TargetCount - 1 + buildconfiguration-Debug-buildstep0 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822 + DEFAULTS_PATH=/usr/share/gconf/gnome.default.path + DESKTOP_SESSION=gnome + DISPLAY=:0.0 + GDMSESSION=gnome + GDM_KEYBOARD_LAYOUT=us + GDM_LANG=ru_RU.UTF-8 + GNOME_DESKTOP_SESSION_ID=this-is-deprecated + GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf + GTK_MODULES=canberra-gtk-module + HOME=/home/andrey + LANG=ru_RU.UTF-8 + LD_LIBRARY_PATH=/usr/lib/qtcreator: + LOGNAME=andrey + MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path + ORBIT_SOCKETDIR=/tmp/orbit-andrey + PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games + PWD=/home/andrey + QTDIR=/usr/share/qt4 + SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205 + SHELL=/bin/bash + SPEECHD_PORT=6561 + SSH_AGENT_PID=1239 + SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh + USER=andrey + USERNAME=andrey + XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database + XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg + XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ + XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279 + + + /home/andrey/AD/aliendefender/ADeditor/ADeditor.pro + -spec + linux-g++ + -r + CONFIG+=debug + + /usr/bin/qmake-qt4 + false + /home/andrey/AD/aliendefender/ADeditor + - ProjectExplorer.Project.Updater.FileVersion - 4 + buildconfiguration-Debug-buildstep1 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822 + DEFAULTS_PATH=/usr/share/gconf/gnome.default.path + DESKTOP_SESSION=gnome + DISPLAY=:0.0 + GDMSESSION=gnome + GDM_KEYBOARD_LAYOUT=us + GDM_LANG=ru_RU.UTF-8 + GNOME_DESKTOP_SESSION_ID=this-is-deprecated + GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf + GTK_MODULES=canberra-gtk-module + HOME=/home/andrey + LANG=ru_RU.UTF-8 + LD_LIBRARY_PATH=/usr/lib/qtcreator: + LOGNAME=andrey + MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path + ORBIT_SOCKETDIR=/tmp/orbit-andrey + PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games + PWD=/home/andrey + QTDIR=/usr/share/qt4 + SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205 + SHELL=/bin/bash + SPEECHD_PORT=6561 + SSH_AGENT_PID=1239 + SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh + USER=andrey + USERNAME=andrey + XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database + XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg + XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ + XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279 + + false + + -w + + /usr/bin/make + true + /home/andrey/AD/aliendefender/ADeditor + + + + buildconfiguration-Debug-cleanstep0 + + Debug + true + + clean + + + + + buildconfiguration-Release-buildstep0 + + Release + + + + buildconfiguration-Release-buildstep1 + + Release + + + + buildconfiguration-Release-cleanstep0 + + Release + + + + buildconfigurations + + Debug + Release + + + + buildstep0 + + + + + + + buildstep1 + + + + + + buildsteps + + trolltech.qt4projectmanager.qmake + trolltech.qt4projectmanager.make + + + + cleanstep0 + + + true + + + + cleansteps + + trolltech.qt4projectmanager.make + + + + defaultFileEncoding + System + + + project + diff --git a/ADeditor/mainwindow.cpp b/ADeditor/mainwindow.cpp index ae3ce67..169bfa0 100644 --- a/ADeditor/mainwindow.cpp +++ b/ADeditor/mainwindow.cpp @@ -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; iwaveParts.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; ilevTowers.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; ichains.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; ichains.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); diff --git a/ADeditor/mainwindow.ui b/ADeditor/mainwindow.ui index d473d22..8033b2c 100644 --- a/ADeditor/mainwindow.ui +++ b/ADeditor/mainwindow.ui @@ -24,10 +24,24 @@ 2 + + + + Save + + + + + + + Cancel + + + - 3 + 4 @@ -709,7 +723,7 @@ - + @@ -726,35 +740,6 @@ - - - - - 0 - 0 - - - - - 40 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -777,6 +762,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -915,6 +913,9 @@ + + true + @@ -1001,7 +1002,7 @@ - + @@ -1018,35 +1019,6 @@ - - - - - 0 - 0 - - - - - 40 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -1069,6 +1041,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -1342,6 +1327,9 @@ + + true + 1 @@ -1466,20 +1454,192 @@ - - - - - - Save - - - - - - - Cancel - + + + Maps + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + 0 + 0 + 0 + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + QGraphicsView::ScrollHandDrag + + + + + + + + + + 0 + 0 + + + + Name + + + + + + + true + + + + + + + + + + + + 0 + 0 + + + + Width + + + + + + + true + + + 99999999 + + + + + + + + + + + + 0 + 0 + + + + Height + + + + + + + true + + + 99999999 + + + + + + + + + + + + 0 + 0 + + + + MaxPlayers + + + + + + + true + + + 99999999 + + + + + + + + + Edit... + + + + + + + + + + 20 + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Delete + + + + + + + @@ -1489,4 +1649,3 @@ - diff --git a/ad_graphics.cpp b/ad_graphics.cpp index 5dc5f9e..1d3cf10 100644 --- a/ad_graphics.cpp +++ b/ad_graphics.cpp @@ -39,10 +39,10 @@ AD_Graphics::AD_Graphics(AD_Core *adcore, QWidget *parent) : QGraphicsView(paren // pen.setColor(Qt::yellow); // brush.setColor(Qt::yellow); // } - if (cel >= Map::Player || (cel <= Map::PlayerTower && cel !=Map::Wall)) + if (cel >= Map::Free || (cel <= Map::PlayerTower && cel !=Map::Wall)) { - pen.setColor(QColor(qAbs(cel)*345%255,(qAbs(cel)*721)%255,(qAbs(cel)*75)%255,50)); - brush.setColor(QColor(qAbs(cel)*345%255,(qAbs(cel)*721)%255,(qAbs(cel)*75)%255,50)); + pen.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,50)); + brush.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,50)); } p.setPen(pen); p.setBrush(brush); @@ -89,6 +89,38 @@ void AD_Graphics::timerEvent(QTimerEvent * ) void AD_Graphics::drawBackground(QPainter * p, const QRectF & ) { p->drawImage(0,0,*mapimg); +// for (int i=0; imap->cells().size(); i++) { +// for (int j=0; jmap->cells().at(i).size(); j++) { +// QPen pen; +// QBrush brush; +// pen.setColor(Qt::white); +// brush.setColor(Qt::white); +// brush.setStyle(Qt::SolidPattern); +// int cel = data->map->cells().at(i).at(j); +// if (cel == Map::Wall) +// { +// pen.setColor(Qt::black); +// brush.setColor(Qt::black); +// } +// // if (cel <= Map::PlayerTower && cel !=Map::Wall) { +// // pen.setColor(QColor(cel%255,(cel*100)%255,(cel+100)%255)); +// // brush.setColor(QColor(cel%255,(cel*100)%255,(cel+100)%255)); +// // } +// // if (cel >= Map::PlayerAlien) { +// // pen.setColor(Qt::yellow); +// // brush.setColor(Qt::yellow); +// // } +// if (cel >= Map::Free || (cel <= Map::PlayerTower && cel !=Map::Wall)) +// { +// pen.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,50)); +// brush.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,50)); +// } +// p->setPen(pen); +// p->setBrush(brush); +// p->drawRect(i*cellSize,j*cellSize,cellSize,cellSize); +// } +// } + //qDebug() << "t:" << data->curTowers.size(); for (QHash::iterator i = data->curTowers.begin(); i != data->curTowers.end(); ++i) { diff --git a/adcore.cpp b/adcore.cpp index 0c970fe..171f34b 100644 --- a/adcore.cpp +++ b/adcore.cpp @@ -24,7 +24,7 @@ AD_Core::AD_Core(QObject *parent) : // adaliens->addAlien(0); // adaliens->AddAlien(0); // adaliens->AddAlien(0); - adtowers->addTower(0,2,QPoint(15,1)); + //adtowers->addTower(0,2,QPoint(15,1)); for (int i=0; i<20;i++) // adtowers->addTower(0,1,QPoint(8,20-i)); // for (int i=0; i<20; i++) diff --git a/aliendefender.pro.user b/aliendefender.pro.user index be6236a..0381f94 100644 --- a/aliendefender.pro.user +++ b/aliendefender.pro.user @@ -58,6 +58,7 @@ Debug 0 0 + 2 @@ -66,6 +67,7 @@ Release 0 + 0 diff --git a/data2.xml b/data2.xml index 07075f0..1766af4 100644 --- a/data2.xml +++ b/data2.xml @@ -5,7 +5,8 @@ - + + @@ -24,7 +25,7 @@ - + @@ -66,9 +67,10 @@ - + + diff --git a/map.cpp b/map.cpp index 95729c1..a494b15 100644 --- a/map.cpp +++ b/map.cpp @@ -91,10 +91,10 @@ void Map::delTowerOnMap(int playerId, QPoint pos) bool Map::isReachable(int playerId, QPoint pos) { - Cells[pos.x()][pos.y()]=PlayerTower-playerId; - Cells[pos.x()+1][pos.y()]=PlayerTower-playerId; - Cells[pos.x()][pos.y()+1]=PlayerTower-playerId; - Cells[pos.x()+1][pos.y()+1]=PlayerTower-playerId; + Cells[pos.x()][pos.y()]=PlayerTower-Player-playerId; + Cells[pos.x()+1][pos.y()]=PlayerTower-Player-playerId; + Cells[pos.x()][pos.y()+1]=PlayerTower-Player-playerId; + Cells[pos.x()+1][pos.y()+1]=PlayerTower-Player-playerId; for (int i=0; icurAliens.contains(aim)) spl.destination = gameData->curAliens.value(aim).pos+QPointF(0.5,0.5); - else - spl.destination = dest; - } else { - spl.AlienId = -1; - spl.destination = dest; } - spl.pos = pos; spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI; spl.imgType = src.imgType; spl.life = 0; spl.src = srcId; - //TriggerType trig; srcTriggerType trig; for(int i=0; icurAliens.value(tw.aim).pos; - // if (src.autoControl) - // spl.AlienId = tw.aim; - // else - // spl.AlienId = -1; - // spl.pos = tw.pos+QPointF(0.5,0.5); // FIXME: splash do not create in center or left-angle of tower, it must be in tower's side - // spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI; - // spl.imgType = src.imgType; - // spl.life = 0; - // spl.src = 0; - // //TriggerType trig; - // for(int i=0; iplayers.at(tw.PlayerId)->srcTowers.at(tw.src).triggers.at(src.triggerIndexes.at(i)); - // switch (trig.type) - // { - // case srcTriggerType::onDestination : - // tod.src = src.triggerIndexes.at(i); - // spl.trigsOnDest.append(tod); - // break; - // case srcTriggerType::onAlienInRadius : - // toa.src = src.triggerIndexes.at(i); - // spl.trigsOnAlien.append(toa); - // break; - // case srcTriggerType::onTimer : - // tot.src = src.triggerIndexes.at(i); - // tot.timer = trig.timer; - // spl.trigsOnTimer.append(tot); - // break; - // } - - // } - // //qDebug() << "t=" << src.triggerIndexes.size() << "d=" << spl.trigsOnDest.size(); - // gameData->curSplashes.insert(spl.id,spl); - // nextId++; - // } } @@ -131,16 +76,12 @@ void Splashes::update() { float arctg,angl; SplashType spl = gameData->curSplashes.values().at(i); - //bool isTowerSplash = false; srcSplashType src; // FIXME : if splash is not tower's splash, will be some trouble src = gameData->players.at(spl.PlayerId)->srcTowers.at(spl.srcTower).splashes.at(spl.src); spl.life++; if (spl.life > src.lifetime) deadIndexes.append(spl.id); - //isTowerSplash = true; - //if (!isTowerSplash) - // src = gameData->srcSplashes.at(spl.src); if (src.autoControl) { bool badAl = false; @@ -153,35 +94,9 @@ void Splashes::update() if (badAl) deadIndexes.push_back(spl.id); spl.pos = spl.destination; - for (int k=0; kplayers.at(spl.PlayerId)->srcTowers.at(spl.srcTower).triggers.at(spl.trigsOnDest.at(k).src); - if (strig.delParent) deadIndexes.push_back(spl.id); - if (strig.count > 0 && strig.childId > 0) - { - //qDebug("bvgbjdklbvfjldsk"); - addSplash(spl.PlayerId,spl.srcTower,strig.childId,spl.pos,spl.destination,-1,spl.TowerId); - } - if (strig.damage > 0) - { - if (!(strig.radius > 0)) - { - if (!badAl) - { - float hh = gameData->curAliens[spl.AlienId].health -= strig.damage; - if (hh < 0) - gameData->curAliens.remove(spl.AlienId); - //qDebug() << "health=" << hh; - } - } else { - processTrigger(strig,spl.pos); - } - } - } + doTriggerOnDest(spl,&deadIndexes,badAl); } arctg = std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()); - //if (tmpdy < 0) arctg=arctg+M_PI; angl = 180.0f*(-arctg)/M_PI; spl.angle = angl; spl.pos.setX(spl.pos.x() @@ -196,17 +111,7 @@ void Splashes::update() if (distance2(spl.pos, spl.destination) < src.speed*src.speed) { spl.pos = spl.destination; - for (int k=0; kplayers.at(spl.PlayerId)->srcTowers.at(spl.srcTower).triggers.at(spl.trigsOnDest.at(k).src); - if (strig.delParent) deadIndexes.push_back(spl.id); - processTrigger(strig,spl.pos); - if (strig.count > 0 && strig.childId > 0) - { - //qDebug("bvgbjdklbvfjldsk"); - addSplash(spl.PlayerId,spl.srcTower,strig.childId,spl.pos,spl.destination,-1,spl.TowerId); - } - } + doTriggerOnDest(spl,&deadIndexes,true); } } spl.pos.setX(spl.pos.x() @@ -215,7 +120,6 @@ void Splashes::update() -src.speed*std::cos(-spl.angle*M_PI/180.f)); } // TODO: smooth splash rotate - // TODO: activate trigger and more... gameData->curSplashes.insert(spl.id,spl); } for (int j=0; j *deadIndexes, + bool badAl) { - //qDebug("trig proc"); - QList dead; - for (QHash::iterator i = gameData->curAliens.begin(); i != gameData->curAliens.end(); ++i) + for (int k=0; kplayers. + at(spl.PlayerId)->srcTowers. + at(spl.srcTower).triggers. + at(spl.trigsOnDest.at(k).src); + if (strig.delParent) deadIndexes->append(spl.id); + if (strig.count > 0 && strig.childId > 0) { - (*i).health -= srctrig.damage; - //qDebug() << "health=" << hh; - if ((*i).health < 0) dead.append((*i).id); + for (int j=0; j 0) + { + if (!(strig.radius > 0)) + { + if (!badAl) + { + float hh = gameData->curAliens[spl.AlienId].health -= strig.damage; + if (hh < 0) + gameData->curAliens.remove(spl.AlienId); + } + } else { + QList dead; + for (QHash::iterator + i = gameData->curAliens.begin(); + i != gameData->curAliens.end(); ++i) + { + if (distance2(spl.pos, (*i).pos) < strig.radius*strig.radius) + { + (*i).health -= strig.damage; + if ((*i).health < 0) dead.append((*i).id); + } + } + for (int i=0; icurAliens.remove(dead.at(i)); + } } } - for (int i=0; icurAliens.remove(dead.at(i)); } diff --git a/splashes.h b/splashes.h index 153bad5..636e6da 100644 --- a/splashes.h +++ b/splashes.h @@ -20,7 +20,7 @@ private: Game_Data *gameData; int nextId; - void processTrigger(srcTriggerType srctrig,QPointF pos); + void doTriggerOnDest(const SplashType &spl, QList * deadIndexes, bool badAl); }; #endif // SPLASHES_H