mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Make possible to play with different timers independently
This commit is contained in:
		| @@ -63,7 +63,7 @@ AdventureMapInterface::AdventureMapInterface(): | ||||
| 	shortcuts->setState(EAdventureState::MAKING_TURN); | ||||
| 	widget->getMapView()->onViewMapActivated(); | ||||
|  | ||||
| 	if(LOCPLINT->cb->getStartInfo()->turnTimerInfo.isEnabled()) | ||||
| 	if(LOCPLINT->cb->getStartInfo()->turnTimerInfo.isEnabled() || LOCPLINT->cb->getStartInfo()->turnTimerInfo.isBattleEnabled()) | ||||
| 		watches = std::make_shared<TurnTimerWidget>(); | ||||
| 	 | ||||
| 	addUsedEvents(KEYBOARD | TIME); | ||||
|   | ||||
| @@ -14,12 +14,12 @@ VCMI_LIB_NAMESPACE_BEGIN | ||||
|  | ||||
| bool TurnTimerInfo::isEnabled() const | ||||
| { | ||||
| 	return turnTimer > 0; | ||||
| 	return turnTimer > 0 || baseTimer > 0; | ||||
| } | ||||
|  | ||||
| bool TurnTimerInfo::isBattleEnabled() const | ||||
| { | ||||
| 	return creatureTimer > 0; | ||||
| 	return creatureTimer > 0 || battleTimer > 0; | ||||
| } | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|   | ||||
| @@ -30,12 +30,9 @@ void TurnTimerHandler::onGameplayStart(PlayerColor player) | ||||
| { | ||||
| 	if(const auto * si = gameHandler.getStartInfo()) | ||||
| 	{ | ||||
| 		if(si->turnTimerInfo.isEnabled()) | ||||
| 		{ | ||||
| 			std::lock_guard<std::recursive_mutex> guard(mx); | ||||
| 			timers[player] = si->turnTimerInfo; | ||||
| 			timers[player].turnTimer = 0; | ||||
| 		} | ||||
| 		std::lock_guard<std::recursive_mutex> guard(mx); | ||||
| 		timers[player] = si->turnTimerInfo; | ||||
| 		timers[player].turnTimer = 0; | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user