From 351aef666f49f8e3f848321b0adcffb9513d30c6 Mon Sep 17 00:00:00 2001 From: kloot Date: Sun, 5 Sep 2010 15:29:37 +0200 Subject: [PATCH] * fix #2083 (units ignored ETA failures when <= 200 elmos from goal, even if goal unreachable) --- rts/Sim/MoveTypes/GroundMoveType.cpp | 37 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/rts/Sim/MoveTypes/GroundMoveType.cpp b/rts/Sim/MoveTypes/GroundMoveType.cpp index 3347867e666..038f68f28ed 100644 --- a/rts/Sim/MoveTypes/GroundMoveType.cpp +++ b/rts/Sim/MoveTypes/GroundMoveType.cpp @@ -374,27 +374,28 @@ void CGroundMoveType::SlowUpdate() return; } - if ((progressState == Active) && (pathId != 0) && (etaFailures > (65536 / turnRate))) { - if (owner->pos.SqDistance2D(goalPos) > (200.0f * 200.0f)) { - // too many ETA failures and not within acceptable range of - // our goal, request a new path from our current position - #if (DEBUG_OUTPUT == 1) - logOutput.Print("[CGMT::SU] ETA failure for unit %i", owner->id); - #endif - - StopEngine(); - StartEngine(); + if (progressState == Active) { + if (pathId != 0) { + if (etaFailures > (65536 / turnRate)) { + // we have a path but are not moving (based on the ETA failure count) + #if (DEBUG_OUTPUT == 1) + logOutput.Print("[CGMT::SU] unit %i has path %i but %i ETA failures", owner->id, pathId, etaFailures); + #endif + + StopEngine(); + StartEngine(); + } + } else { + if (gs->frameNum > restartDelay) { + // we want to be moving but don't have a path + #if (DEBUG_OUTPUT == 1) + logOutput.Print("[CGMT::SU] unit %i has no path", owner->id); + #endif + StartEngine(); + } } } - // If the action is active, but not the engine and the - // re-try-delay has passed, then start the engine. - if (progressState == Active && (pathId == 0) && (gs->frameNum > restartDelay)) { - #if (DEBUG_OUTPUT == 1) - logOutput.Print("[CGMT::SU] restart engine for unit %i", owner->id); - #endif - StartEngine(); - } if (!flying) { // just kindly move it into the map again instead of deleting