From ff1bcb0d030abf12766a11f9945384dbd3b67a25 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 29 Apr 2021 15:32:39 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8FClean=20up=20ItemDoppel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/items.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index fead17400..316e6aca8 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -284,8 +284,6 @@ _sfx_id ItemInvSnds[] = { IS_ILARM, IS_ILARM, }; -/** Specifies the current Y-coordinate used for validation of items on ground. */ -int idoppely = 16; /** Maps from Griswold premium item number to a quality level delta as added to the base quality level. */ int premiumlvladd[] = { // clang-format off @@ -3000,21 +2998,22 @@ void DeleteItem(int ii, int i) void ItemDoppel() { - int idoppelx; - ItemStruct *i; + if (!gbIsMultiplayer) + return; - if (gbIsMultiplayer) { - for (idoppelx = 16; idoppelx < 96; idoppelx++) { - if (dItem[idoppelx][idoppely]) { - i = &items[dItem[idoppelx][idoppely] - 1]; - if (i->position.x != idoppelx || i->position.y != idoppely) - dItem[idoppelx][idoppely] = 0; - } + static int idoppely = 16; + + for (int idoppelx = 16; idoppelx < 96; idoppelx++) { + if (dItem[idoppelx][idoppely]) { + ItemStruct *i = &items[dItem[idoppelx][idoppely] - 1]; + if (i->position.x != idoppelx || i->position.y != idoppely) + dItem[idoppelx][idoppely] = 0; } - idoppely++; - if (idoppely == 96) - idoppely = 16; } + + idoppely++; + if (idoppely == 96) + idoppely = 16; } void ProcessItems()