Merge pull request #1585 from Pryaxis/fix-projectiles

Fix #1584 / Revert "Change Utils.SearchProjectile to return -1 in error"
This commit is contained in:
Chris 2017-12-27 02:19:58 +00:00 committed by GitHub
commit 830b1634f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -979,7 +979,7 @@ namespace TShockAPI
short type = args.Type; short type = args.Type;
int index = args.Index; int index = args.Index;
if (index > Main.maxProjectiles || index < 0) if (index > Main.maxProjectiles)
{ {
args.Player.RemoveProjectile(ident, owner); args.Player.RemoveProjectile(ident, owner);
args.Handled = true; args.Handled = true;

View file

@ -925,7 +925,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 or -1 if not found</returns> /// <returns>projectile ID</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++)
@ -933,7 +933,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 -1; return 1000;
} }
/// <summary> /// <summary>