make linkDirection more robust to member reordering

This commit is contained in:
cawtds
2025-04-09 13:40:39 +02:00
parent a3075325a0
commit 1672d99060
4 changed files with 24 additions and 21 deletions
+1 -1
View File
@@ -2931,7 +2931,7 @@ static void ZeroObjectEvent(struct ObjectEvent *objEvent)
// conflict with the usual Event Object struct, thus the definitions.
#define linkGender(obj) obj->singleMovementActive
// not even one can reference *byte* aligned bitfield members...
#define linkDirection(obj) ((u8 *)obj)[offsetof(typeof(*obj), fieldEffectSpriteId) - 1] // -> rangeX
#define linkDirection(obj) ((u8 *)obj)[offsetof(typeof(*obj), range)] // -> rangeX
static void SpawnLinkPlayerObjectEvent(u8 linkPlayerId, s16 x, s16 y, u8 gender)
{