towers_is_shot
This commit is contained in:
30
map.cpp
30
map.cpp
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user