comparison UI/UIPopup.cpp @ 1944:02bc0fac639f

fixing inventory right click crash
author Grumpy7
date Fri, 25 Oct 2013 00:51:32 -0700
parents 2e6d3cd052e0
children c1c74df0a33e
comparison
equal deleted inserted replaced
1943:c193d289f0a5 1944:02bc0fac639f
1600 if (no_rightlick_in_inventory) 1600 if (no_rightlick_in_inventory)
1601 return; 1601 return;
1602 1602
1603 pMouse->GetCursorPos(&cursor); 1603 pMouse->GetCursorPos(&cursor);
1604 int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1; 1604 int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1;
1605 if (item_pid == -1) //added here to avoid crash
1606 return;
1605 auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; 1607 auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid];
1606 1608
1607 if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(вещи вне инвентаря) 1609 if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(вещи вне инвентаря)
1608 { 1610 {
1609 GameUI_DrawItemInfo(item); 1611 GameUI_DrawItemInfo(item);