fix: Cleans up Point checks and removes statics (#966)
- [X] Removes static freezing/unfreezing. Use other tools for this. - [X] Cleans up IPoint3D allocations - [X] Removes IPoint3D constructors since the compiler may not optimize the constructor path and allow allocations. Note: Instead of `new Point3D(m)`, do something like `new Point3D(m.Location)`. Sorry for the inconvenience. In the long run this will prevent abuse of hot paths that will cause performance issues.
This commit is contained in:
parent
23532db603
commit
0925a2d435
18 changed files with 184 additions and 958 deletions
|
|
@ -115,7 +115,7 @@ namespace Server.Gumps
|
|||
{
|
||||
case 1: // Current location
|
||||
{
|
||||
toSet = new Point2D(m_Mobile.Location);
|
||||
toSet = new Point2D(m_Mobile.Location.X, m_Mobile.Location.Y);
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
|
|
@ -194,12 +194,13 @@ namespace Server.Gumps
|
|||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is IPoint3D p)
|
||||
if (targeted is IPoint3D point3D)
|
||||
{
|
||||
try
|
||||
{
|
||||
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, new Point2D(p).ToString());
|
||||
m_Property.SetValue(m_Object, new Point2D(p), null);
|
||||
var p = new Point2D(point3D.X, point3D.Y);
|
||||
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, p.ToString());
|
||||
m_Property.SetValue(m_Object, p, null);
|
||||
m_PropertiesGump.OnValueChanged(m_Object, m_Property);
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue