Such utility, so many wows

This commit is contained in:
Raymond Lynch 2021-06-16 08:42:42 -04:00
parent ba8780e047
commit 98781f0bcd
2 changed files with 32 additions and 27 deletions

View file

@ -43,33 +43,7 @@ namespace Dalamud.Game.ClientState.Actors.Types
/// <summary>
/// Gets the displayname of this <see cref="Actor" />.
/// </summary>
public string Name
{
get
{
if (this.name == null)
{
var i = 0;
for (; i < this.actorStruct.Name.Length; i++)
{
if (this.actorStruct.Name[i] == 0)
break;
}
if (i == this.actorStruct.Name.Length)
{
this.name = Encoding.UTF8.GetString(this.actorStruct.Name);
Log.Warning($"Warning: Actor name exceeds underlying struct array length (name={this.name})");
}
else
{
this.name = Encoding.UTF8.GetString(this.actorStruct.Name, 0, i);
}
}
return this.name;
}
}
public string Name => this.name ??= Util.GetUTF8String(this.actorStruct.Name);
/// <summary>
/// Gets the actor ID of this <see cref="Actor" />.