- bugfixes for multi-build. Now the other units are checked that they can not only build but repair too. Also those who repair now try to approach from the best angle as well as the builder.

This commit is contained in:
Mark Vejvoda 2010-09-01 04:19:20 +00:00
parent f07cbb13ad
commit d6d1fe2add
2 changed files with 15 additions and 13 deletions

View File

@ -90,14 +90,16 @@ CommandResult Commander::tryGiveCommand(const Selection *selection, const Comman
}
}
NetworkCommand networkCommand(this->world,nctGiveCommand, unitId,
useCommandtype->getId(), usePos, unitType->getId(),
(targetUnit != NULL ? targetUnit->getId() : -1),
facing, tryQueue, commandStateType,commandStateValue);
if(useCommandtype != NULL) {
NetworkCommand networkCommand(this->world,nctGiveCommand, unitId,
useCommandtype->getId(), usePos, unitType->getId(),
(targetUnit != NULL ? targetUnit->getId() : -1),
facing, tryQueue, commandStateType,commandStateValue);
//every unit is ordered to a the position
CommandResult result= pushNetworkCommand(&networkCommand);
results.push_back(result);
//every unit is ordered to a the position
CommandResult result= pushNetworkCommand(&networkCommand);
results.push_back(result);
}
}
return computeResult(results);

View File

@ -810,19 +810,19 @@ void UnitUpdater::updateRepair(Unit *unit) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] rct = %p\n",__FILE__,__FUNCTION__,__LINE__,rct);
Unit *repaired= map->getCell(command->getPos())->getUnit(fLand);
bool nextToRepaired= repaired!=NULL && map->isNextTo(unit->getPos(), repaired);
Unit *repaired = map->getCell(command->getPos())->getUnit(fLand);
bool nextToRepaired = repaired != NULL && map->isNextTo(unit->getPos(), repaired);
Unit *peerUnitBuilder = NULL;
if(repaired == NULL) {
peerUnitBuilder = findPeerUnitBuilder(unit);
if(peerUnitBuilder != NULL) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] peerUnitBuilder = %p\n",__FILE__,__FUNCTION__,__LINE__,peerUnitBuilder);
// command->getPos()-Vec2i(1)
//nextToRepaired= map->isNextTo(unit->getPos(), command->getPos()-Vec2i(1));
nextToRepaired= (unit->getPos() == (command->getPos()-Vec2i(1)));
Vec2i buildPos = map->findBestBuildApproach(unit->getPos(), command->getPos(), peerUnitBuilder->getCurrCommand()->getUnitType());
//nextToRepaired= (unit->getPos() == (command->getPos()-Vec2i(1)));
nextToRepaired = (unit->getPos() == buildPos);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] peerUnitBuilder = %p, nextToRepaired = %d\n",__FILE__,__FUNCTION__,__LINE__,peerUnitBuilder,nextToRepaired);