OpenRA/OpenRA — pull request #7126 by penev92 (2014-12-14 00:50:35+00:00)
Title: Fix worms not releasing targets when they move deep onto rock

Meant to fix the problem described in #7125, introduced by #6821.
Basically the worm checked if a target is valid when:
- Searching for one
- Launching an attack against the current target

This means that if a unit reached solid ground before an attack, one of 2 things would happen:
- It will be on rock, but near the edge and inside the worm's attack range. The worm will then try to launch the attack and see that the target is no longer valid and move on.
- It will move deep within the rock "island", far from the worm's attack range. The worm would then continue its AttackMoveActivity indefinitely, causing it to not move and also ignore any other possible targets.

I added a check for target validity on each tick of the Attack activity. Now once the target is out of reach the worm should just move on and forget about it.

Note: There were several approaches proposed for fixing the issue, but I feel that:
- This is the simplest one
- It is the most consistent one with what the worm logic already uses
- It is probably the safest way to go and not have a 100 cases where the other approaches might fail