|
5 | 5 | using Intersect.Client.Framework.Input; |
6 | 6 | using Intersect.Client.General; |
7 | 7 | using Intersect.Client.Interface.Game.DescriptionWindows; |
| 8 | +using Intersect.Client.Interface.Game.Inventory; |
8 | 9 | using Intersect.Client.Networking; |
9 | 10 | using Intersect.Configuration; |
10 | 11 | using Intersect.Framework.Core; |
@@ -280,15 +281,20 @@ public void Update() |
280 | 281 | { |
281 | 282 | for (var i = 0; i < Options.Instance.Player.MaxInventory; i++) |
282 | 283 | { |
283 | | - if (invWindow.Items[i].RenderBounds().IntersectsWith(dragRect)) |
| 284 | + if(invWindow.Items[i] is not InventoryItem inventoryItem) |
284 | 285 | { |
285 | | - if (FloatRect.Intersect(invWindow.Items[i].RenderBounds(), dragRect).Width * |
286 | | - FloatRect.Intersect(invWindow.Items[i].RenderBounds(), dragRect).Height > |
| 286 | + continue; |
| 287 | + } |
| 288 | + |
| 289 | + if (inventoryItem.RenderBounds().IntersectsWith(dragRect)) |
| 290 | + { |
| 291 | + if (FloatRect.Intersect(inventoryItem.RenderBounds(), dragRect).Width * |
| 292 | + FloatRect.Intersect(inventoryItem.RenderBounds(), dragRect).Height > |
287 | 293 | bestIntersect) |
288 | 294 | { |
289 | 295 | bestIntersect = |
290 | | - FloatRect.Intersect(invWindow.Items[i].RenderBounds(), dragRect).Width * |
291 | | - FloatRect.Intersect(invWindow.Items[i].RenderBounds(), dragRect).Height; |
| 296 | + FloatRect.Intersect(inventoryItem.RenderBounds(), dragRect).Width * |
| 297 | + FloatRect.Intersect(inventoryItem.RenderBounds(), dragRect).Height; |
292 | 298 |
|
293 | 299 | bestIntersectIndex = i; |
294 | 300 | } |
|
0 commit comments