From 97e6c712c8e00c7dd227229183e611ef90dec245 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 26 Oct 2021 02:48:29 +0200 Subject: [PATCH] Correctly position durability icons Fixes #3275 --- Source/control.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 080ff1457..d05977119 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1504,18 +1504,18 @@ void ReleaseChrBtns(bool addAllStatPoints) void DrawDurIcon(const Surface &out) { - bool hasRoomBetweenPanels = gnScreenWidth >= PANEL_WIDTH + 16 + (32 + 8 + 32 + 8 + 32 + 8 + 32) + 16; - bool hasRoomUnderPanels = gnScreenHeight >= SPANEL_HEIGHT + PANEL_HEIGHT + 16 + 32 + 16; + bool hasRoomBetweenPanels = RightPanel.position.x - (LeftPanel.position.x + LeftPanel.size.width) >= 16 + (32 + 8 + 32 + 8 + 32 + 8 + 32) + 16; + bool hasRoomUnderPanels = MainPanel.position.y - (RightPanel.position.y + RightPanel.size.height) >= 16 + 32 + 16; if (!hasRoomBetweenPanels && !hasRoomUnderPanels) { if ((chrflag || QuestLogIsOpen) && (invflag || sbookflag)) return; } - int x = PANEL_X + PANEL_WIDTH - 32 - 16; + int x = MainPanel.position.x + MainPanel.size.width - 32 - 16; if (!hasRoomUnderPanels) { - if (invflag || sbookflag) - x -= SPANEL_WIDTH - (gnScreenWidth - PANEL_WIDTH) / 2; + if ((invflag || sbookflag) && MainPanel.position.x + MainPanel.size.width > RightPanel.position.x) + x -= MainPanel.position.x + MainPanel.size.width - RightPanel.position.x; } auto &myPlayer = Players[MyPlayerId];