Ejemplo n.º 1
0
void Inventory::selectSlot(const std::string& selectedSlotId, ItemType type) {
	if (selectedSlotId.empty()) {
		deselectCurrentSlot();
		return;
	}
	m_hasDraggingStarted = true;
	m_isEquipmentSlotDragged = type != ItemType::VOID;
	m_startMousePosition = g_inputController->getDefaultViewMousePosition();

	if (selectedSlotId.compare(m_selectedSlotId.first) == 0) return;
	
	deselectCurrentSlot();
	m_selectedSlotId.first = selectedSlotId;
	m_selectedSlotId.second = type;
	InventorySlot* selectedSlot = getSelectedSlot();
	hideDocument();
	if (selectedSlot != nullptr) {
		selectedSlot->select();
		showDescription(selectedSlot->getItem());
	}
}