diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index f3a176fc..5775381e 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -1332,19 +1332,6 @@ void UnitUpdater::updateRepair(Unit *unit) { //repairPos = command->getPos()-Vec2i(1); } - if(startRepairing == false && repaired == NULL) { - SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - // we have a repair command to the ground! We must find first units in visible range of target point. - - startRepairing = damagedRepairableUnitOnRange(rct, repairPos, unit->getType()->getSight(), &repaired); - //if(startRepairing) command->setPos(repaired->getCenteredPos()); - if(repaired != NULL){ - startRepairing = true; - nextToRepaired = repaired != NULL && map->isNextTo(unit->getPos(), repaired); - repairPos=repaired->getCenteredPos(); - command->setPos(repairPos); - } - } //if not repairing if(startRepairing == true) { SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -1849,40 +1836,6 @@ void UnitUpdater::findEnemiesForCell(const AttackSkillType *ast, Cell *cell, con } } -bool UnitUpdater::damagedRepairableUnitOnRange(const RepairCommandType* rct, Vec2i repairPos, int range, Unit **unitToRepair){ - Vec2f floatRepairPos = Vec2f(repairPos.x, repairPos.y); - - Unit* damagedUnit=NULL; - int bestDistanced=-1; - - for(int i=repairPos.x-range; iisInside(i, j) && streflop::floor(floatRepairPos.dist(Vec2f((float)i, (float)j))) <= (range+1)){ -#else - if(map->isInside(i, j) && floor(floatRepairPos.dist(Vec2f((float)i, (float)j))) <= (range+1)){ -#endif - Cell *cell = map->getCell(i,j); - for(int k = 0; k < fieldCount; k++) { - Field f= static_cast(k); - Unit *possibleUnit = cell->getUnit(f); - if( possibleUnit != NULL && - possibleUnit->getTeam()==world->getThisTeamIndex() && - rct->isRepairableUnitType(possibleUnit->getType()) && - possibleUnit->isDamaged()) { - // possible unit! - *unitToRepair=possibleUnit; - return true; - // TODO choose nearest to repair unit - } - } - } - } - } - return false; -} - //if the unit has any enemy on range bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr, const AttackSkillType *ast){ diff --git a/source/glest_game/world/unit_updater.h b/source/glest_game/world/unit_updater.h index f0e47cd6..10245ccf 100644 --- a/source/glest_game/world/unit_updater.h +++ b/source/glest_game/world/unit_updater.h @@ -126,7 +126,6 @@ private: bool attackableOnRange(const Unit *unit, Unit **enemyPtr, const AttackSkillType *ast); bool unitOnRange(const Unit *unit, int range, Unit **enemyPtr, const AttackSkillType *ast); void enemiesAtDistance(const Unit *unit, const Unit *priorityUnit, int distance, vector &enemies); - bool damagedRepairableUnitOnRange(const RepairCommandType* rct, Vec2i repairPos, int range, Unit **unitToRepair); Unit * findPeerUnitBuilder(Unit *unit); void SwapActiveCommand(Unit *unitSrc, Unit *unitDest);