Change Utils.SearchProjectile to return -1 in error

Thanks for checking this out, @bartico6. Fixes #1549.

Note: this method only returns 1 because the game won't allocate
more identity/index combo. Apparently, according to RL.
This commit is contained in:
Lucas Nicodemus 2017-12-11 08:18:23 -07:00
parent 6ed110f862
commit e19fd22fe0

View file

@ -943,7 +943,7 @@ namespace TShockAPI
/// </summary> /// </summary>
/// <param name="identity">identity</param> /// <param name="identity">identity</param>
/// <param name="owner">owner</param> /// <param name="owner">owner</param>
/// <returns>projectile ID</returns> /// <returns>projectile ID or -1 if not found</returns>
public int SearchProjectile(short identity, int owner) public int SearchProjectile(short identity, int owner)
{ {
for (int i = 0; i < Main.maxProjectiles; i++) for (int i = 0; i < Main.maxProjectiles; i++)
@ -951,7 +951,7 @@ namespace TShockAPI
if (Main.projectile[i].identity == identity && Main.projectile[i].owner == owner) if (Main.projectile[i].identity == identity && Main.projectile[i].owner == owner)
return i; return i;
} }
return 1000; return -1;
} }
/// <summary> /// <summary>