浏览代码

Added hardcoded min/max simturns duration

Ivan Savenko 2 年之前
父节点
当前提交
64c43c91dc
共有 2 个文件被更改,包括 17 次插入5 次删除
  1. 13 4
      server/processors/TurnOrderProcessor.cpp
  2. 4 1
      server/processors/TurnOrderProcessor.h

+ 13 - 4
server/processors/TurnOrderProcessor.cpp

@@ -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;
 

+ 4 - 1
server/processors/TurnOrderProcessor.h

@@ -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;