mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Hold timer client counter
This commit is contained in:
parent
21af69e0b7
commit
b5417c667c
@ -140,7 +140,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player):
|
||||
firstCall = 1; //if loading will be overwritten in serialize
|
||||
autosaveCount = 0;
|
||||
isAutoFightOn = false;
|
||||
|
||||
timerEnabled = true;
|
||||
duringMovement = false;
|
||||
ignoreEvents = false;
|
||||
numOfMovedArts = 0;
|
||||
@ -272,6 +272,8 @@ void CPlayerInterface::yourTurn(QueryID queryID)
|
||||
makingTurn = true;
|
||||
adventureInt->onPlayerTurnStarted(playerID);
|
||||
}
|
||||
|
||||
timerEnabled = false;
|
||||
}
|
||||
acceptTurn(queryID);
|
||||
}
|
||||
@ -324,6 +326,7 @@ void CPlayerInterface::acceptTurn(QueryID queryID)
|
||||
}
|
||||
|
||||
cb->selectionMade(0, queryID);
|
||||
timerEnabled = true;
|
||||
}
|
||||
|
||||
void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose)
|
||||
@ -2124,3 +2127,8 @@ std::optional<BattleAction> CPlayerInterface::makeSurrenderRetreatDecision(const
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool CPlayerInterface::isTimerEnabled() const
|
||||
{
|
||||
return timerEnabled;
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ namespace boost
|
||||
/// Central class for managing user interface logic
|
||||
class CPlayerInterface : public CGameInterface, public IUpdateable
|
||||
{
|
||||
bool timerEnabled;
|
||||
bool duringMovement;
|
||||
bool ignoreEvents;
|
||||
size_t numOfMovedArts;
|
||||
@ -206,6 +207,8 @@ public: // public interface for use by client via LOCPLINT access
|
||||
|
||||
///returns true if all events are processed internally
|
||||
bool capturedAllEvents();
|
||||
|
||||
bool isTimerEnabled() const;
|
||||
|
||||
CPlayerInterface(PlayerColor Player);
|
||||
~CPlayerInterface();
|
||||
|
@ -114,7 +114,8 @@ void TurnTimerWidget::tick(uint32_t msPassed)
|
||||
continue;
|
||||
|
||||
auto time = LOCPLINT->cb->getPlayerTurnTime(player);
|
||||
cachedTurnTime -= msPassed;
|
||||
if(LOCPLINT->isTimerEnabled())
|
||||
cachedTurnTime -= msPassed;
|
||||
if(cachedTurnTime < 0) cachedTurnTime = 0; //do not go below zero
|
||||
|
||||
if(lastPlayer != player)
|
||||
|
Loading…
Reference in New Issue
Block a user