diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 39cfd6d3..c1783192 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -1093,7 +1093,6 @@ Unit * UnitUpdater::findPeerUnitBuilder(Unit *unit) { if(bct != NULL) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - //if(command->getPos() == peerCommand->getPos()) { if(command->getStateValue() == peerUnit->getId()) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -1109,11 +1108,10 @@ Unit * UnitUpdater::findPeerUnitBuilder(Unit *unit) { if(prct != NULL) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - if(unit != peerUnit && command->getStateValue() == peerUnit->getId()) { + if(unit->getId() != peerUnit->getId() && command->getStateValue() == peerUnit->getId()) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); firstLinkedPeerRepairer = peerUnit; - break; } } } @@ -1122,7 +1120,7 @@ Unit * UnitUpdater::findPeerUnitBuilder(Unit *unit) { } } - if(foundUnitBuilder == NULL) { + if(foundUnitBuilder == NULL && firstLinkedPeerRepairer != NULL) { foundUnitBuilder = firstLinkedPeerRepairer; } }