Adds hue support to StaticTile (#1321)
### Summary Fixes missing properties while reading static tiles. ### Screenshots <img width="463" alt="Screenshot 2023-01-21 093050" src="https://user-images.githubusercontent.com/3953314/213879788-05d2ad7c-c197-4690-9f5b-660bded416cc.png"> Closes #1320
This commit is contained in:
parent
b18dfcbb63
commit
68bd9529f9
5 changed files with 51 additions and 8 deletions
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Server;
|
||||
|
||||
|
|
@ -34,7 +36,37 @@ public class TileList
|
|||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void Add(StaticTile* ptr) => Add(Marshal.PtrToStructure<StaticTile>((nint)ptr));
|
||||
|
||||
public void Add(StaticTile tile)
|
||||
{
|
||||
TryResize();
|
||||
m_Tiles[Count] = tile;
|
||||
++Count;
|
||||
}
|
||||
|
||||
public void Add(ushort id, byte x, byte y, sbyte z, short hue = 0)
|
||||
{
|
||||
TryResize();
|
||||
ref var tile = ref m_Tiles[Count];
|
||||
tile.m_ID = id;
|
||||
tile.m_X = x;
|
||||
tile.m_Y = y;
|
||||
tile.m_Z = z;
|
||||
tile.m_Hue = hue;
|
||||
++Count;
|
||||
}
|
||||
|
||||
public void Add(ushort id, sbyte z)
|
||||
{
|
||||
TryResize();
|
||||
m_Tiles[Count].m_ID = id;
|
||||
m_Tiles[Count].m_Z = z;
|
||||
++Count;
|
||||
}
|
||||
|
||||
private void TryResize()
|
||||
{
|
||||
if (Count + 1 > m_Tiles.Length)
|
||||
{
|
||||
|
|
@ -46,10 +78,6 @@ public class TileList
|
|||
m_Tiles[i] = old[i];
|
||||
}
|
||||
}
|
||||
|
||||
m_Tiles[Count].m_ID = id;
|
||||
m_Tiles[Count].m_Z = z;
|
||||
++Count;
|
||||
}
|
||||
|
||||
public StaticTile[] ToArray()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue