From 98875e16ac649ec203f46fdbbf3986c3348e4b4b Mon Sep 17 00:00:00 2001 From: MarioE Date: Tue, 21 Aug 2012 10:32:47 -0400 Subject: [PATCH] No need for a duplicate method. --- TShockAPI/GetDataHandlers.cs | 6 +++--- TShockAPI/Utils.cs | 15 ++------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 639c8aab..1fde7fc9 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -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; diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 58bd0c19..1b49a4f9 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -313,9 +313,9 @@ namespace TShockAPI /// Location X /// Location Y /// If the tile is valid - 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; } /// @@ -785,17 +785,6 @@ namespace TShockAPI return HashPassword(Encoding.UTF8.GetBytes(password)); } - /// - /// Checks if the given X and Y are in range for the world's tile array - /// - /// X - /// Y - /// True if the X and Y are in range - public bool TileInRange(int X, int Y) - { - return X >= 0 && Y >= 0 && X < Main.maxTilesX - 1 && Y < Main.maxTilesY - 1; - } - /// /// Checks if the string contains any unprintable characters ///