- 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:
parent
f07cbb13ad
commit
d6d1fe2add
|
@ -90,14 +90,16 @@ CommandResult Commander::tryGiveCommand(const Selection *selection, const Comman
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkCommand networkCommand(this->world,nctGiveCommand, unitId,
|
if(useCommandtype != NULL) {
|
||||||
useCommandtype->getId(), usePos, unitType->getId(),
|
NetworkCommand networkCommand(this->world,nctGiveCommand, unitId,
|
||||||
(targetUnit != NULL ? targetUnit->getId() : -1),
|
useCommandtype->getId(), usePos, unitType->getId(),
|
||||||
facing, tryQueue, commandStateType,commandStateValue);
|
(targetUnit != NULL ? targetUnit->getId() : -1),
|
||||||
|
facing, tryQueue, commandStateType,commandStateValue);
|
||||||
|
|
||||||
//every unit is ordered to a the position
|
//every unit is ordered to a the position
|
||||||
CommandResult result= pushNetworkCommand(&networkCommand);
|
CommandResult result= pushNetworkCommand(&networkCommand);
|
||||||
results.push_back(result);
|
results.push_back(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return computeResult(results);
|
return computeResult(results);
|
||||||
|
|
|
@ -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);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] rct = %p\n",__FILE__,__FUNCTION__,__LINE__,rct);
|
||||||
|
|
||||||
Unit *repaired= map->getCell(command->getPos())->getUnit(fLand);
|
Unit *repaired = map->getCell(command->getPos())->getUnit(fLand);
|
||||||
bool nextToRepaired= repaired!=NULL && map->isNextTo(unit->getPos(), repaired);
|
bool nextToRepaired = repaired != NULL && map->isNextTo(unit->getPos(), repaired);
|
||||||
|
|
||||||
Unit *peerUnitBuilder = NULL;
|
Unit *peerUnitBuilder = NULL;
|
||||||
if(repaired == NULL) {
|
if(repaired == NULL) {
|
||||||
peerUnitBuilder = findPeerUnitBuilder(unit);
|
peerUnitBuilder = findPeerUnitBuilder(unit);
|
||||||
|
|
||||||
if(peerUnitBuilder != NULL) {
|
if(peerUnitBuilder != NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] peerUnitBuilder = %p\n",__FILE__,__FUNCTION__,__LINE__,peerUnitBuilder);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] peerUnitBuilder = %p\n",__FILE__,__FUNCTION__,__LINE__,peerUnitBuilder);
|
||||||
|
|
||||||
// command->getPos()-Vec2i(1)
|
Vec2i buildPos = map->findBestBuildApproach(unit->getPos(), command->getPos(), peerUnitBuilder->getCurrCommand()->getUnitType());
|
||||||
//nextToRepaired= map->isNextTo(unit->getPos(), command->getPos()-Vec2i(1));
|
|
||||||
nextToRepaired= (unit->getPos() == (command->getPos()-Vec2i(1)));
|
//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);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] peerUnitBuilder = %p, nextToRepaired = %d\n",__FILE__,__FUNCTION__,__LINE__,peerUnitBuilder,nextToRepaired);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue