From c300905d70ea449cfb6eae6325a5be0e064b9f73 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 28 Sep 2010 19:52:31 +0000 Subject: [PATCH] - a better attempt to fix the issue with multi-build where the repairers stop repairing --- source/glest_game/world/unit_updater.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index ec1b2484..54b74ac2 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -855,6 +855,10 @@ void UnitUpdater::updateRepair(Unit *unit) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit = %p\n",__FILE__,__FUNCTION__,__LINE__,unit); + if(unit != NULL) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit doing the repair [%s] - %d\n",__FILE__,__FUNCTION__,__LINE__,unit->getFullName().c_str(),unit->getId()); + } + Chrono chrono; chrono.start(); @@ -865,9 +869,19 @@ void UnitUpdater::updateRepair(Unit *unit) { Unit *repaired = map->getCell(command->getPos())->getUnit(fLand); + if(repaired != NULL) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit to repair [%s] - %d\n",__FILE__,__FUNCTION__,__LINE__,repaired->getFullName().c_str(),repaired->getId()); + } + // Check if the 'repaired' unit is actually the peer unit in a multi-build? Unit *peerUnitBuilder = findPeerUnitBuilder(unit); - if(peerUnitBuilder != NULL && peerUnitBuilder == repaired) { + + if(peerUnitBuilder != NULL) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit peer [%s] - %d\n",__FILE__,__FUNCTION__,__LINE__,peerUnitBuilder->getFullName().c_str(),peerUnitBuilder->getId()); + } + + // Esnure we have the right unit to repair + if(peerUnitBuilder != NULL) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] peerUnitBuilder = %p\n",__FILE__,__FUNCTION__,__LINE__,peerUnitBuilder); if(peerUnitBuilder->getCurrCommand()->getUnit() != NULL) {