浏览代码

show cheating problem message only once per AI

Laserlicht 1 年之前
父节点
当前提交
560923fc1f
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 6 1
      AI/Nullkiller/AIGateway.cpp
  2. 1 0
      AI/Nullkiller/AIGateway.h

+ 6 - 1
AI/Nullkiller/AIGateway.cpp

@@ -77,6 +77,7 @@ AIGateway::AIGateway()
 	destinationTeleport = ObjectInstanceID();
 	destinationTeleportPos = int3(-1);
 	nullkiller.reset(new Nullkiller());
+	announcedCheatingProblem = false;
 }
 
 AIGateway::~AIGateway()
@@ -831,7 +832,11 @@ void AIGateway::makeTurn()
 	if(cb->getStartInfo()->extraOptionsInfo.cheatsAllowed)
 		cb->sendMessage("vcmieagles");
 	else
-		cb->sendMessage("Nullkiller AI currently requires the ability to cheat in order to function correctly! Please enable!");
+	{
+		if(!announcedCheatingProblem)
+			cb->sendMessage("Nullkiller AI currently requires the ability to cheat in order to function correctly! Please enable!");
+		announcedCheatingProblem = true;
+	}
 
 	retrieveVisitableObjs();
 

+ 1 - 0
AI/Nullkiller/AIGateway.h

@@ -96,6 +96,7 @@ public:
 	std::unique_ptr<boost::thread> makingTurn;
 private:
 	boost::mutex turnInterruptionMutex;
+	bool announcedCheatingProblem;
 public:
 	ObjectInstanceID selectedObject;