From f403d12d8ce55eb0f7bac3e9569caa1069281881 Mon Sep 17 00:00:00 2001 From: mr-russ <> Date: Thu, 22 May 2003 02:25:47 +0000 Subject: [PATCH] If attacking a point, and we can't get there, try different points --- src/action/action_attack.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/action/action_attack.cpp b/src/action/action_attack.cpp index a3b9a7a39..c7938fd89 100644 --- a/src/action/action_attack.cpp +++ b/src/action/action_attack.cpp @@ -270,6 +270,7 @@ local void MoveToTarget(Unit* unit) || (!unit->Orders[0].Goal && WallOnMap(unit->Orders[0].X,unit->Orders[0].Y)) ) { // FIXME: workaround for pathfinder problem + // FIXME: is this true with the new pathfinding?? DebugLevel3Fn("FIXME: Johns remove this for new orders.\n"); unit->Orders[0].X-=unit->Orders[0].RangeX; unit->Orders[0].Y-=unit->Orders[0].RangeY; @@ -342,7 +343,14 @@ local void MoveToTarget(Unit* unit) if( goal ) { DebugLevel0(", target %d\n" _C_ UnitNumber(goal)); } else { - DebugLevel0("\n"); + DebugLevel0(", (%d,%d) Tring with more range...\n" _C_ unit->Orders[0].X _C_ unit->Orders[0].Y); + } + if( unit->Orders[0].RangeX < TheMap.Width + || unit->Orders[0].RangeY < TheMap.Height ) { + // Try again with more range + unit->Orders[0].RangeX++; + unit->Orders[0].RangeY++; + return; } } if( unit->Orders[0].Goal ) {