mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	vcmi: request pop all when hero is moved
This way new pickup will show immidately.
This commit is contained in:
		| @@ -324,6 +324,7 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose) | ||||
| 	if (!hero) | ||||
| 		return; | ||||
|  | ||||
| 	adventureInt->infoBar->requestPopAll(); | ||||
| 	if (details.result == TryMoveHero::EMBARK || details.result == TryMoveHero::DISEMBARK) | ||||
| 	{ | ||||
| 		if (hero->getRemovalSound()) | ||||
|   | ||||
| @@ -268,7 +268,7 @@ void CInfoBar::tick() | ||||
| { | ||||
| 	removeUsedEvents(TIME); | ||||
| 	if(GH.topInt() == adventureInt) | ||||
| 		popComponents(); | ||||
| 		popComponents(true); | ||||
| } | ||||
|  | ||||
| void CInfoBar::clickLeft(tribool down, bool previousState) | ||||
| @@ -280,7 +280,7 @@ void CInfoBar::clickLeft(tribool down, bool previousState) | ||||
| 		else if(state == GAME) | ||||
| 			showDate(); | ||||
| 		else | ||||
| 			popComponents(); | ||||
| 			popComponents(true); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -334,6 +334,8 @@ void CInfoBar::pushComponents(const std::vector<Component> & components, std::st | ||||
| 			vect.erase(vect.begin(), vect.begin() + std::min(vect.size(), max)); | ||||
| 		}; | ||||
| 	}; | ||||
| 	if(shouldPopAll) | ||||
| 		popAll(); | ||||
| 	if(components.empty()) | ||||
| 		prepareComponents(components, message, timer); | ||||
| 	else | ||||
| @@ -421,20 +423,27 @@ void CInfoBar::prepareComponents(const std::vector<Component> & components, std: | ||||
| 	return; | ||||
| } | ||||
|  | ||||
| void CInfoBar::requestPopAll() | ||||
| { | ||||
| 	shouldPopAll = true; | ||||
| } | ||||
|  | ||||
| void CInfoBar::popAll() | ||||
| { | ||||
| 	componentsQueue = {}; | ||||
| 	shouldPopAll = false; | ||||
| } | ||||
|  | ||||
| void CInfoBar::popComponents() | ||||
| void CInfoBar::popComponents(bool remove) | ||||
| { | ||||
| 	OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE); | ||||
| 	if(remove && !componentsQueue.empty()) | ||||
| 		componentsQueue.pop(); | ||||
| 	if(!componentsQueue.empty()) | ||||
| 	{ | ||||
| 		state = COMPONENT; | ||||
| 		const auto & extracted = componentsQueue.front(); | ||||
| 		visibleInfo = std::make_shared<VisibleComponentInfo>(extracted.first); | ||||
| 		componentsQueue.pop(); | ||||
| 		setTimer(extracted.second); | ||||
| 		redraw(); | ||||
| 		return; | ||||
|   | ||||
| @@ -138,6 +138,7 @@ private: | ||||
|  | ||||
| 	std::shared_ptr<CVisibleInfo> visibleInfo; | ||||
| 	EState state; | ||||
| 	bool shouldPopAll = false; | ||||
|  | ||||
| 	std::queue<std::pair<VisibleComponentInfo::Cache, int>> componentsQueue; | ||||
|  | ||||
| @@ -145,7 +146,7 @@ private: | ||||
| 	void showComponents(const std::vector<Component> & comps, std::string message, int textH, bool tiny, int timer); | ||||
| 	void pushComponents(const std::vector<Component> & comps, std::string message, int textH, bool tiny, int timer); | ||||
| 	void prepareComponents(const std::vector<Component> & comps, std::string message, int timer); | ||||
| 	void popComponents(); | ||||
| 	void popComponents(bool remove = false); | ||||
|  | ||||
| 	//removes all information about current state, deactivates timer (if any) | ||||
| 	void reset(); | ||||
| @@ -170,6 +171,9 @@ public: | ||||
| 	/// Remove all queued components | ||||
| 	void popAll(); | ||||
|  | ||||
| 	/// Request infobar to pop all after next InfoWindow arrives. | ||||
| 	void requestPopAll(); | ||||
|  | ||||
| 	/// print enemy turn progress | ||||
| 	void startEnemyTurn(PlayerColor color); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user