I give up on this :( . Softcoder must help me here I don't understand whats going on. We still see out of syncs if this is commented in.

This commit is contained in:
Titus Tscharntke 2012-05-31 21:54:00 +00:00
parent d6f04c66e0
commit 3f604ae359
1 changed files with 22 additions and 20 deletions

View File

@ -2346,13 +2346,15 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
//attack enemies that can attack first
float distToUnit= -1;
float distToStandingUnit= -1;
Unit* enemySeen= NULL;
Unit* attackingEnemySeen= NULL;
ControlType controlType= unit->getFaction()->getControlType();
bool isUltra= controlType == ctCpuUltra || controlType == ctNetworkCpuUltra;
bool isMega= controlType == ctCpuMega || controlType == ctNetworkCpuMega;
//TT float distToStandingUnit= -1;
// Unit* attackingEnemySeen= NULL;
// ControlType controlType= unit->getFaction()->getControlType();
// bool isUltra= controlType == ctCpuUltra || controlType == ctNetworkCpuUltra;
// bool isMega= controlType == ctCpuMega || controlType == ctNetworkCpuMega;
//printf("unit %d has control:%d\n",unit->getId(),controlType);
for(int i = 0; i< enemies.size(); ++i) {
Unit *enemy = enemies[i];
@ -2374,25 +2376,25 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
result = true;
}
if(isUltra || isMega) {
if(distToStandingUnit < 0 || currentDist< distToStandingUnit) {
if(enemies[i]->getCurrSkill()!=NULL && enemies[i]->getCurrSkill()->getClass()==scAttack) {
distToStandingUnit = currentDist;
attackingEnemySeen=enemies[i];
}
}
}
//TT if(isUltra || isMega) {
// if(distToStandingUnit < 0 || currentDist< distToStandingUnit) {
// if(enemies[i]->getCurrSkill()!=NULL && enemies[i]->getCurrSkill()->getClass()==scAttack) {
// distToStandingUnit = currentDist;
// attackingEnemySeen=enemies[i];
// }
// }
// }
}
}
}
if(isUltra || isMega) {
if( attackingEnemySeen!=NULL && random.randRange(0,2)!=2 ) {
*rangedPtr = attackingEnemySeen;
enemySeen = attackingEnemySeen;
//printf("Da hat er wen gefunden:%s\n",enemySeen->getType()->getName(false).c_str());
}
}
//TT if(isUltra || isMega) {
// if( attackingEnemySeen!=NULL && random.randRange(0,2)!=2 ) {
// *rangedPtr = attackingEnemySeen;
// enemySeen = attackingEnemySeen;
// //printf("Da hat er wen gefunden:%s\n",enemySeen->getType()->getName(false).c_str());
// }
// }
if(result == true) {
//const Unit* teamUnit = NULL;