mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	crash fixed
This commit is contained in:
		| @@ -103,38 +103,38 @@ void CArtifactsOfHeroBase::setShowPopupArtPlacesCallback(const CArtPlace::ClickF | ||||
|  | ||||
| void CArtifactsOfHeroBase::clickPressedArtPlace(CComponentHolder & artPlace, const Point & cursorPosition) | ||||
| { | ||||
| 	auto ownedPlace = getArtPlace(cursorPosition); | ||||
| 	assert(ownedPlace != nullptr); | ||||
| 	if(auto ownedPlace = getArtPlace(cursorPosition)) | ||||
| 	{ | ||||
| 		if(ownedPlace->isLocked()) | ||||
| 			return; | ||||
|  | ||||
| 	if(ownedPlace->isLocked()) | ||||
| 		return; | ||||
|  | ||||
| 	if(clickPressedCallback) | ||||
| 		clickPressedCallback(*ownedPlace, cursorPosition); | ||||
| 		if(clickPressedCallback) | ||||
| 			clickPressedCallback(*ownedPlace, cursorPosition); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CArtifactsOfHeroBase::showPopupArtPlace(CComponentHolder & artPlace, const Point & cursorPosition) | ||||
| { | ||||
| 	auto ownedPlace = getArtPlace(cursorPosition); | ||||
| 	assert(ownedPlace != nullptr); | ||||
| 	if(auto ownedPlace = getArtPlace(cursorPosition)) | ||||
| 	{ | ||||
| 		if(ownedPlace->isLocked()) | ||||
| 			return; | ||||
|  | ||||
| 	if(ownedPlace->isLocked()) | ||||
| 		return; | ||||
|  | ||||
| 	if(showPopupCallback) | ||||
| 		showPopupCallback(*ownedPlace, cursorPosition); | ||||
| 		if(showPopupCallback) | ||||
| 			showPopupCallback(*ownedPlace, cursorPosition); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CArtifactsOfHeroBase::gestureArtPlace(CComponentHolder & artPlace, const Point & cursorPosition) | ||||
| { | ||||
| 	auto ownedPlace = getArtPlace(cursorPosition); | ||||
| 	assert(ownedPlace != nullptr); | ||||
| 	if(auto ownedPlace = getArtPlace(cursorPosition)) | ||||
| 	{ | ||||
| 		if(ownedPlace->isLocked()) | ||||
| 			return; | ||||
|  | ||||
| 	if(ownedPlace->isLocked()) | ||||
| 		return; | ||||
|  | ||||
| 	if(gestureCallback) | ||||
| 		gestureCallback(*ownedPlace, cursorPosition); | ||||
| 		if(gestureCallback) | ||||
| 			gestureCallback(*ownedPlace, cursorPosition); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CArtifactsOfHeroBase::setHero(const CGHeroInstance * hero) | ||||
|   | ||||
| @@ -24,24 +24,24 @@ CArtifactsOfHeroMarket::CArtifactsOfHeroMarket(const Point & position, const int | ||||
|  | ||||
| void CArtifactsOfHeroMarket::clickPressedArtPlace(CComponentHolder & artPlace, const Point & cursorPosition) | ||||
| { | ||||
| 	auto ownedPlace = getArtPlace(cursorPosition); | ||||
| 	assert(ownedPlace != nullptr); | ||||
|  | ||||
| 	if(ownedPlace->isLocked()) | ||||
| 		return; | ||||
|  | ||||
| 	if(const auto art = getArt(ownedPlace->slot)) | ||||
| 	if(auto ownedPlace = getArtPlace(cursorPosition)) | ||||
| 	{ | ||||
| 		if(onSelectArtCallback && art->getType()->isTradable()) | ||||
| 		if(ownedPlace->isLocked()) | ||||
| 			return; | ||||
|  | ||||
| 		if(const auto art = getArt(ownedPlace->slot)) | ||||
| 		{ | ||||
| 			unmarkSlots(); | ||||
| 			artPlace.selectSlot(true); | ||||
| 			onSelectArtCallback(ownedPlace.get()); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			if(onClickNotTradableCallback) | ||||
| 				onClickNotTradableCallback(); | ||||
| 			if(onSelectArtCallback && art->getType()->isTradable()) | ||||
| 			{ | ||||
| 				unmarkSlots(); | ||||
| 				artPlace.selectSlot(true); | ||||
| 				onSelectArtCallback(ownedPlace.get()); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				if(onClickNotTradableCallback) | ||||
| 					onClickNotTradableCallback(); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user