1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Added hardcoded min/max simturns duration

This commit is contained in:
Ivan Savenko 2023-09-19 19:46:27 +03:00
parent 64c82c9133
commit 64c43c91dc
2 changed files with 17 additions and 5 deletions

View File

@ -24,7 +24,13 @@ TurnOrderProcessor::TurnOrderProcessor(CGameHandler * owner):
}
int TurnOrderProcessor::simturnsTurnsLimit() const
int TurnOrderProcessor::simturnsTurnsMaxLimit() const
{
// TODO
return 28;
}
int TurnOrderProcessor::simturnsTurnsMinLimit() const
{
// TODO
return 7;
@ -45,9 +51,6 @@ bool TurnOrderProcessor::canActSimultaneously(PlayerColor active, PlayerColor wa
assert(activeInfo);
assert(waitingInfo);
if (gameHandler->getDate(Date::DAY) > simturnsTurnsLimit())
return false;
if (gameHandler->hasBothPlayersAtSameConnection(active, waiting))
{
// only one AI and one human can play simultaneoulsy from single connection
@ -55,6 +58,12 @@ bool TurnOrderProcessor::canActSimultaneously(PlayerColor active, PlayerColor wa
return false;
}
if (gameHandler->getDate(Date::DAY) < simturnsTurnsMinLimit())
return true;
if (gameHandler->getDate(Date::DAY) > simturnsTurnsMaxLimit())
return false;
if (playersInContact(active, waiting))
return false;

View File

@ -22,7 +22,10 @@ class TurnOrderProcessor : boost::noncopyable
std::set<PlayerColor> actedPlayers;
/// Returns date on which simturns must end unconditionally
int simturnsTurnsLimit() const;
int simturnsTurnsMaxLimit() const;
/// Returns date until which simturns must play unconditionally
int simturnsTurnsMinLimit() const;
/// Returns true if players are close enough to each other for their heroes to meet on this turn
bool playersInContact(PlayerColor left, PlayerColor right) const;