Cleanup/Housekeeping (#242)

This commit is contained in:
Kamron Batman 2020-09-12 15:31:21 -07:00 • committed by GitHub
parent 90ede0659f
commit 741e8d8300
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
228 changed files with 6292 additions and 2690 deletions

View file

@ -1,23 +1,3 @@
/***************************************************************************
* Gump.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
@ -232,15 +212,21 @@ namespace Server.Gumps
public void Add(GumpEntry g)
{
if (g.Parent != this)
{
g.Parent = this;
}
else if (!Entries.Contains(g))
{
Entries.Add(g);
}
}
public void Remove(GumpEntry g)
{
if (g == null || !Entries.Contains(g))
{
return;
}
Entries.Remove(g);
g.Parent = null;
@ -250,7 +236,10 @@ namespace Server.Gumps
{
var indexOf = Strings.IndexOf(value);
if (indexOf >= 0) return indexOf;
if (indexOf >= 0)
{
return indexOf;
}
Strings.Add(value);
return Strings.Count - 1;
@ -269,21 +258,33 @@ namespace Server.Gumps
IGumpWriter disp;
if (ns?.Unpack == true)
{
disp = new DisplayGumpPacked(this);
}
else
{
disp = new DisplayGumpFast(this);
}
if (!Draggable)
{
disp.AppendLayout(m_NoMove);
}
if (!Closable)
{
disp.AppendLayout(m_NoClose);
}
if (!Disposable)
{
disp.AppendLayout(m_NoDispose);
}
if (!Resizable)
{
disp.AppendLayout(m_NoResize);
}
var count = Entries.Count;