Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Factions;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
|
@ -161,7 +162,7 @@ namespace Server.Items
|
|||
if (from is BaseFactionGuard)
|
||||
return false;
|
||||
|
||||
if ((from.Direction & Direction.Running) != 0 || Boat != null && !Boat.Contains(from))
|
||||
if ((from.Direction & Direction.Running) != 0 || Boat?.Contains(from) == false)
|
||||
return true;
|
||||
|
||||
Map map = Map;
|
||||
|
|
@ -222,16 +223,7 @@ namespace Server.Items
|
|||
|
||||
public bool CanClose()
|
||||
{
|
||||
Map map = Map;
|
||||
|
||||
if (map == null || Deleted)
|
||||
return false;
|
||||
|
||||
foreach (object o in GetObjectsInRange(0))
|
||||
if (o != this)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return Map != null && !Deleted && GetObjectsInRange(0).Cast<object>().All(o => o == this);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
|
@ -334,4 +326,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue