fix: Fixes sending packets and sidesteps a major issue with stackalloc and PGO in .NET 8 (#1607)
### Summary - Works around a sneaky edge case bug in the JIT with stackalloc where sometimes the buffer is not zero'd. - Fixes SendDisplayBoatHS - Fixes sending health bars in the `SendEverything()` logic. - Fixes a bug in sizing for some string helper functions. ### Developer Note We are enabled `SkipLocalsInit` - do not rely on `stackalloc` to be zero'd. To zero the buffer, use `span.Clear();` Closes #1606
This commit is contained in:
parent
79ba1ea917
commit
03f850fe03
18 changed files with 67 additions and 76 deletions
|
|
@ -2721,9 +2721,9 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
Span<byte> facialHairPacket = stackalloc byte[facialHairLength].InitializePacket();
|
||||
|
||||
const int cacheLength = OutgoingMobilePackets.MobileMovingPacketCacheByteLength;
|
||||
const int width = OutgoingMobilePackets.MobileMovingPacketLength;
|
||||
|
||||
var mobileMovingCache = stackalloc byte[cacheLength].InitializePackets(width);
|
||||
Span<byte> mobileMovingCache = stackalloc byte[cacheLength];
|
||||
mobileMovingCache.Clear();
|
||||
|
||||
var ourState = m_NetState;
|
||||
|
||||
|
|
@ -4369,9 +4369,9 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
if (moveClientQueue.Count > 0)
|
||||
{
|
||||
const int cacheLength = OutgoingMobilePackets.MobileMovingPacketCacheByteLength;
|
||||
const int width = OutgoingMobilePackets.MobileMovingPacketLength;
|
||||
|
||||
var mobileMovingCache = stackalloc byte[cacheLength].InitializePackets(width);
|
||||
Span<byte> mobileMovingCache = stackalloc byte[cacheLength];
|
||||
mobileMovingCache.Clear();
|
||||
|
||||
while (moveClientQueue.Count > 0)
|
||||
{
|
||||
|
|
@ -6923,8 +6923,14 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
|
||||
if (ns.StygianAbyss)
|
||||
{
|
||||
ns.SendMobileHealthbar(m, Healthbar.Poison);
|
||||
ns.SendMobileHealthbar(m, Healthbar.Yellow);
|
||||
if (m.Blessed || m.YellowHealthbar)
|
||||
{
|
||||
ns.SendMobileHealthbar(m, Healthbar.Yellow);
|
||||
}
|
||||
else if (m.Poisoned)
|
||||
{
|
||||
ns.SendMobileHealthbar(m, Healthbar.Poison);
|
||||
}
|
||||
}
|
||||
|
||||
if (m.IsDeadBondedPet)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue