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