mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Make possible to play with different timers independently
This commit is contained in:
parent
6226ddf4a7
commit
4ee47b01ae
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user