ctNetworkCpuUltra was the problem ...
This commit is contained in:
parent
4a70d090a8
commit
d6f04c66e0
|
@ -2345,10 +2345,14 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
|
||||||
}
|
}
|
||||||
|
|
||||||
//attack enemies that can attack first
|
//attack enemies that can attack first
|
||||||
float distToUnit=-1;
|
float distToUnit= -1;
|
||||||
//TT float distToStandingUnit=-1;
|
float distToStandingUnit= -1;
|
||||||
Unit* enemySeen = NULL;
|
Unit* enemySeen= NULL;
|
||||||
//TT Unit* attackingEnemySeen = NULL;
|
Unit* attackingEnemySeen= NULL;
|
||||||
|
ControlType controlType= unit->getFaction()->getControlType();
|
||||||
|
bool isUltra= controlType == ctCpuUltra || controlType == ctNetworkCpuUltra;
|
||||||
|
bool isMega= controlType == ctCpuMega || controlType == ctNetworkCpuMega;
|
||||||
|
|
||||||
for(int i = 0; i< enemies.size(); ++i) {
|
for(int i = 0; i< enemies.size(); ++i) {
|
||||||
Unit *enemy = enemies[i];
|
Unit *enemy = enemies[i];
|
||||||
|
|
||||||
|
@ -2370,54 +2374,26 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TT
|
if(isUltra || isMega) {
|
||||||
// if(unit->getFaction()->getControlType()==ctCpuUltra ||
|
if(distToStandingUnit < 0 || currentDist< distToStandingUnit) {
|
||||||
// unit->getFaction()->getControlType()==ctCpuMega) {
|
if(enemies[i]->getCurrSkill()!=NULL && enemies[i]->getCurrSkill()->getClass()==scAttack) {
|
||||||
// if(distToStandingUnit < 0 || currentDist< distToStandingUnit) {
|
distToStandingUnit = currentDist;
|
||||||
// if(enemies[i]->getCurrSkill()!=NULL && enemies[i]->getCurrSkill()->getClass()==scAttack) {
|
attackingEnemySeen=enemies[i];
|
||||||
// distToStandingUnit = currentDist;
|
}
|
||||||
// attackingEnemySeen=enemies[i];
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TT if(unit->getFaction()->getControlType()==ctCpuUltra ||
|
if(isUltra || isMega) {
|
||||||
// unit->getFaction()->getControlType()==ctCpuMega) {
|
if( attackingEnemySeen!=NULL && random.randRange(0,2)!=2 ) {
|
||||||
// if( attackingEnemySeen!=NULL && random.randRange(0,2)!=2 ) {
|
*rangedPtr = attackingEnemySeen;
|
||||||
// *rangedPtr = attackingEnemySeen;
|
enemySeen = attackingEnemySeen;
|
||||||
// enemySeen = attackingEnemySeen;
|
//printf("Da hat er wen gefunden:%s\n",enemySeen->getType()->getName(false).c_str());
|
||||||
// //printf("Da hat er wen gefunden:%s\n",enemySeen->getType()->getName(false).c_str());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*
|
|
||||||
if(enemies[i]->getType()->hasSkillClass(scAttack) &&
|
|
||||||
enemies[i]->isAlive() == true ) {
|
|
||||||
*rangedPtr= enemies[i];
|
|
||||||
enemySeen=enemies[i];
|
|
||||||
result=true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(result == false) {
|
|
||||||
//any enemy
|
|
||||||
for(int i= 0; i < enemies.size(); ++i) {
|
|
||||||
if(enemies[i]->isAlive() == true) {
|
|
||||||
*rangedPtr= enemies[i];
|
|
||||||
enemySeen= enemies[i];
|
|
||||||
result= true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(result == true) {
|
if(result == true) {
|
||||||
//const Unit* teamUnit = NULL;
|
//const Unit* teamUnit = NULL;
|
||||||
const Unit* enemyUnit = NULL;
|
const Unit* enemyUnit = NULL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user