From 3f604ae3593163a1c35616a8f2a277046b88207c Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Thu, 31 May 2012 21:54:00 +0000 Subject: [PATCH] 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. --- source/glest_game/world/unit_updater.cpp | 42 +++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 3c3be488..3444c095 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -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;