Using the maxNPCTypes and maxItemTypes constants from Terraria.Main so we don't have to update everytime new things are added

This commit is contained in:
ricky 2011-06-11 09:43:23 +10:00
parent a928a59fe3
commit e663698497
2 changed files with 5 additions and 5 deletions

View file

@ -649,7 +649,7 @@ namespace TShockAPI
return;
}
if (type >= 1 && type <= 45)
if (type >= 1 && type < Main.maxNPCTypes)
{
int npcid = -1;
for (int i = 0; i < amount; i++)
@ -679,7 +679,7 @@ namespace TShockAPI
if (!int.TryParse(args.Parameters[0], out type))
type = TShock.GetItemID(String.Join(" ", args.Parameters));
if (type < 1 || type > 238)
if (type < 1 || type >= Main.maxItemTypes)
{
Tools.SendMessage(adminplr, "Invalid item type!", Color.Red);
return;
@ -732,7 +732,7 @@ namespace TShockAPI
if (!int.TryParse(args.Parameters[0], out type))
type = TShock.GetItemID(args.Parameters[0]);
if (type < 1 || type > 238)
if (type < 1 || type >= Main.maxItemTypes)
{
Tools.SendMessage(args.PlayerID, "Invalid item type!", Color.Red);
return;