Fixes bad expressions, bad bool checks in loops, a few null pointer exceptions, and optimizes constructors.

This commit is contained in:
Kamron Batman 2018-09-15 23:16:45 -07:00
parent 8da55d6043
commit f93c3b992e
62 changed files with 318 additions and 634 deletions

View file

@ -128,8 +128,7 @@ namespace Server.Misc
return false;
if (item is ICommodity || item is BaseBoat
|| item is Fish || item is BigFish
|| item is BasePotion || item is Food || item is CookableFood
|| item is Fish || item is BigFish || item is Food || item is CookableFood
|| item is SpecialFishingNet || item is BaseMagicFish
|| item is Shoes || item is Sandals
|| item is Boots || item is ThighBoots
@ -137,7 +136,6 @@ namespace Server.Misc
|| item is BaseArmor || item is BaseWeapon
|| item is BaseClothing
|| item is BaseJewel && Core.AOS
|| item is BasePotion && Core.ML
#region Champion artifacts

View file

@ -349,7 +349,7 @@ namespace Server.Misc
if (highest == null || check.BaseFixedPoint > highest.BaseFixedPoint)
highest = check;
else if (highest != null && highest.Lock != SkillLock.Up && check.Lock == SkillLock.Up &&
else if (highest.Lock != SkillLock.Up && check.Lock == SkillLock.Up &&
check.BaseFixedPoint == highest.BaseFixedPoint)
highest = check;
}

View file

@ -37,14 +37,11 @@ namespace Server
{
Type type = typeof(T);
if (type != null)
{
MethodInfo m = type.GetMethod("Validate", BindingFlags.Instance | BindingFlags.Public);
MethodInfo m = type.GetMethod("Validate", BindingFlags.Instance | BindingFlags.Public);
if (m != null)
for (int i = 0; i < m_Queue.Count; ++i)
m.Invoke(m_Queue[i], null);
}
if (m != null)
for (int i = 0; i < m_Queue.Count; ++i)
m.Invoke(m_Queue[i], null);
m_Queue.Clear();
m_Queue = null;

View file

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Server.Commands;
using Server.Mobiles;
@ -140,7 +141,7 @@ namespace Server
bool hasSpawner = false;
for (int j = 0; !hasSpawner && j < si.m_Floor.Count; ++j)
for (int j = 0; j < si.m_Floor.Count; ++j)
{
Point2D fp = (Point2D)si.m_Floor[j];
@ -148,13 +149,7 @@ namespace Server
yTotal += fp.Y;
IPooledEnumerable<Spawner> eable = map.GetItemsInRange<Spawner>(new Point3D(fp.X, fp.Y, 0), 0);
foreach (Spawner item in eable)
{
hasSpawner = true;
break;
}
hasSpawner = eable.Any();
eable.Free();
if (hasSpawner)
@ -237,9 +232,7 @@ namespace Server
if (cp == Point2D.Zero)
continue;
int z;
if (!GetFloorZ(map, cp.X, cp.Y, out z))
if (!GetFloorZ(map, cp.X, cp.Y, out int z))
continue;
new Spawner(1, 1, 1, 0, 4, (string)names[j]).MoveToWorld(new Point3D(cp.X, cp.Y, z), map);