UserInterface: 32-bit LONG sockets in TItemData/TShopItemData

The 40250 wire structs hold Win32 long (4 bytes) sockets; on LP64 `long`
is 8, so each TShopItemData was too wide and SHOP_SUBHEADER_GC_START/_EX
misread every item after the first. Pin the wire size with a static_assert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-28 16:56:36 +09:00
co-authored by Claude Opus 5.5
parent d3cf586849
commit 22ca5da387
+5 -2
View File
@@ -321,7 +321,7 @@ typedef struct packet_item
BYTE count;
DWORD flags;
DWORD anti_flags;
long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
LONG alSockets[ITEM_SOCKET_SLOT_MAX_NUM]; // PORT: LONG, the 32-bit Win32 long
TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
} TItemData;
@@ -331,12 +331,15 @@ typedef struct packet_shop_item
DWORD price;
BYTE count;
BYTE display_pos;
long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
LONG alSockets[ITEM_SOCKET_SLOT_MAX_NUM]; // PORT: LONG, the 32-bit Win32 long
TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
} TShopItemData;
#pragma pack(pop)
// PORT: wire sizes of the 32-bit client (SHOP_SUBHEADER_GC_START/_EX send 40 of these back to back).
static_assert(sizeof(TShopItemData) == 43, "TShopItemData must match the 40250 wire layout");
inline float GetSqrtDistance(int ix1, int iy1, int ix2, int iy2) // By sqrt
{
float dx, dy;