No need for a duplicate method.

This commit is contained in:
MarioE 2012-08-21 10:32:47 -04:00
parent 8c8ca02d88
commit 98875e16ac
2 changed files with 5 additions and 16 deletions

View file

@ -1653,7 +1653,7 @@ namespace TShockAPI
var fail = args.Data.ReadBoolean();
if (OnTileEdit(args.Player, tileX, tileY, tiletype, type, fail))
return true;
if (!TShock.Utils.TileInRange(tileX, tileY))
if (!TShock.Utils.TileValid(tileX, tileY))
return false;
if (args.Player.Dead && TShock.Config.PreventDeadModification)
@ -1696,8 +1696,8 @@ namespace TShockAPI
args.Player.SendTileSquare(tileX, tileY);
return true;
}
if ((TShock.Utils.TileInRange(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == 138) ||
(TShock.Utils.TileInRange(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == 138))
if ((TShock.Utils.TileValid(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == 138) ||
(TShock.Utils.TileValid(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == 138))
{
args.Player.SendTileSquare(tileX, tileY);
return true;

View file

@ -313,9 +313,9 @@ namespace TShockAPI
/// <param name="tileX">Location X</param>
/// <param name="tileY">Location Y</param>
/// <returns>If the tile is valid</returns>
private bool TileValid(int tileX, int tileY)
public bool TileValid(int tileX, int tileY)
{
return tileX >= 0 && tileX <= Main.maxTilesX && tileY >= 0 && tileY <= Main.maxTilesY;
return tileX >= 0 && tileX < Main.maxTilesX && tileY >= 0 && tileY < Main.maxTilesY;
}
/// <summary>
@ -785,17 +785,6 @@ namespace TShockAPI
return HashPassword(Encoding.UTF8.GetBytes(password));
}
/// <summary>
/// Checks if the given X and Y are in range for the world's tile array
/// </summary>
/// <param name="X">X</param>
/// <param name="Y">Y</param>
/// <returns>True if the X and Y are in range</returns>
public bool TileInRange(int X, int Y)
{
return X >= 0 && Y >= 0 && X < Main.maxTilesX - 1 && Y < Main.maxTilesY - 1;
}
/// <summary>
/// Checks if the string contains any unprintable characters
/// </summary>