towers_is_shot

This commit is contained in:
unknown
2010-08-29 14:41:27 +04:00
parent 8f9294c405
commit 26439849c8
18 changed files with 1767 additions and 2460 deletions

30
map.cpp
View File

@@ -80,27 +80,37 @@ void Map::removeAliensPath()
bool Map::addTowerOnMap(int playerId, QPoint pos)
{
qDebug() << pos;
if (playerId < 0 || playerId > players) return false;
QRect r(QPoint(),mapSize);
if (!r.contains(pos)) return false;
if (Cells[pos.x()][pos.y()]==Player+playerId)
{
Cells[pos.x()][pos.y()]=PlayerTower-playerId;
for (int i=0; i<Starts.size(); i++) {
for (int j=0; j<Finishs.size(); j++) {
if (waveTrace(Starts.at(i),Finishs.at(j))<0) {
qDebug("AAAAAA");
Cells[pos.x()][pos.y()]=Player+playerId;
return false;
}
}
}
return true;
}
if (Cells[pos.x()][pos.y()]==AlienPath+playerId)
{
Cells[pos.x()][pos.y()]=PlayerTower-playerId;
bool ok=true;
for (int i=0; i<Starts.size(); i++)
for (int j=0; j<Finishs.size(); j++)
if (waveTrace(Starts.at(i),Finishs.at(j))<0) ok = false;
qDebug()<<"ok="<<ok;
if (!ok)
{
Cells[pos.x()][pos.y()]=AlienPath+playerId;
return false;
}
// bool ok=true;
// for (int i=0; i<Starts.size(); i++)
// for (int j=0; j<Finishs.size(); j++)
// if (waveTrace(Starts.at(i),Finishs.at(j))<0) ok = false;
// qDebug()<<"ok="<<ok;
// if (!ok)
// {
// Cells[pos.x()][pos.y()]=AlienPath+playerId;
// return false;
// }
//Cells[pos.x()][pos.y()]=PlayerTower-playerId;
bool * pathOK;
pathOK = new bool();