From 29deb8eb95e31b73abd45b8703ced4d3123748be Mon Sep 17 00:00:00 2001 From: lahm86 <33758420+lahm86@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:57:44 +0100 Subject: [PATCH] inject: fix item creation 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..586525910 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);