From ca04a5cf303edbad04b48ae00794a12f6f7029d1 Mon Sep 17 00:00:00 2001 From: lahm86 <33758420+lahm86@users.noreply.github.com> Date: Thu, 4 Apr 2024 11:42:30 +0100 Subject: [PATCH] inject: fix item creation (#1270) This uses the correct approach to create an item on the fly. The issue itself was unreleased, and the change in c279b4e brought the bug to light. Resolves #1266. --- src/game/inject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/inject.c b/src/game/inject.c index e23bd7347..c84b75564 100644 --- a/src/game/inject.c +++ b/src/game/inject.c @@ -1277,7 +1277,9 @@ static void Inject_TriggeredItem(INJECTION *injection, LEVEL_INFO *level_info) return; } - ITEM_INFO *item = &g_Items[g_LevelItemCount]; + int16_t item_number = Item_Create(); + ITEM_INFO *item = &g_Items[item_number]; + File_Read(&item->object_number, sizeof(int16_t), 1, fp); File_Read(&item->room_number, sizeof(int16_t), 1, fp); File_Read(&item->pos.x, sizeof(int32_t), 1, fp);