From 636b25d725bca3d9d64eb7412b6307e8478eb8e2 Mon Sep 17 00:00:00 2001 From: Regalis Date: Mon, 10 Oct 2016 21:24:46 +0300 Subject: [PATCH] Readded inventory tooltips --- Subsurface/Source/Items/Inventory.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Subsurface/Source/Items/Inventory.cs b/Subsurface/Source/Items/Inventory.cs index 0dbd5bcd3..d65eff5e6 100644 --- a/Subsurface/Source/Items/Inventory.cs +++ b/Subsurface/Source/Items/Inventory.cs @@ -268,8 +268,6 @@ namespace Barotrauma public virtual void Draw(SpriteBatch spriteBatch, bool subInventory = false) { - string toolTip = ""; - if (slots == null || isSubInventory != subInventory) return; for (int i = 0; i < capacity; i++) @@ -295,8 +293,20 @@ namespace Barotrauma for (int i = 0; i < capacity; i++) { - if (slots[i].IsHighlighted && !slots[i].Disabled) + if (slots[i].IsHighlighted && !slots[i].Disabled && Items[i] != null) { + string toolTip = ""; + if (GameMain.DebugDraw) + { + toolTip = Items[i].ToString(); + } + else + { + toolTip = string.IsNullOrEmpty(Items[i].Description) ? + Items[i].Name : + Items[i].Name + '\n' + Items[i].Description; + } + DrawToolTip(spriteBatch, toolTip, slots[i].Rect); break; }