Kinda works. Occasionally crashes (OOM) with a loop in the path.

This commit is contained in:
Bob
2009-11-07 19:18:20 +13:00
parent bb64327568
commit 3ab8ae1afc
2 changed files with 28 additions and 12 deletions

View File

@@ -121,10 +121,10 @@ namespace OpenRa.Game.Traits.Activities
if( newPath.Count == 0 )
return null;
while( path[ path.Count - 1 ] != newPath[ 0 ] )
path.RemoveAt( path.Count - 1 );
while( path.Count != 0 && path[ path.Count - 1 ] != newPath[ 0 ] )
path.RemoveAt( path.Count - 1 );
for( int i = 1 ; i < newPath.Count ; i++ )
path.Add( newPath[ i ] );
path.Add( newPath[ i ] );
if( path.Count == 0 )
return null;