浏览代码

Fix some problems with network game

nordsoft 3 年之前
父节点
当前提交
e865f484ff
共有 3 个文件被更改,包括 6 次插入2 次删除
  1. 4 2
      client/CPlayerInterface.cpp
  2. 1 0
      client/CPlayerInterface.h
  3. 1 0
      server/CGameHandler.cpp

+ 4 - 2
client/CPlayerInterface.cpp

@@ -691,7 +691,7 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
 	lastBattleArmies.second = army2;
 	//quick combat with neutral creatures only
 	auto * army2_object = dynamic_cast<const CGObjectInstance *>(army2);
-	if((!replay && army2_object
+	if((!replay && !allowBattleReplay && army2_object
 		&& army2_object->getOwner() == PlayerColor::UNFLAGGABLE
 		&& settings["adventure"]["quickCombat"].Bool())
 	   || settings["adventure"]["alwaysSkipCombat"].Bool())
@@ -703,6 +703,7 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
 		cb->registerBattleInterface(autofightingAI);
 		// Player shouldn't be able to move on adventure map if quick combat is going
 		adventureInt->quickCombatLock();
+		allowBattleReplay = true;
 	}
 
 	//Don't wait for dialogs when we are non-active hot-seat player
@@ -920,7 +921,8 @@ void CPlayerInterface::battleEnd(const BattleResult *br, QueryID queryID)
 
 		if(!battleInt)
 		{
-			bool replay = !settings["adventure"]["alwaysSkipCombat"].Bool(); //do not allow manual replay
+			bool replay = allowBattleReplay && !settings["adventure"]["alwaysSkipCombat"].Bool(); //do not allow manual replay
+			allowBattleReplay = false;
 			auto wnd = std::make_shared<CBattleResultWindow>(*br, *this, replay);
 			wnd->resultCallback = [=](ui32 selection)
 			{

+ 1 - 0
client/CPlayerInterface.h

@@ -69,6 +69,7 @@ namespace boost
 class CPlayerInterface : public CGameInterface, public IUpdateable
 {
 	const CArmedInstance * currentSelection;
+	bool allowBattleReplay = false;
 	std::pair<const CCreatureSet *, const CCreatureSet *> lastBattleArmies;
 
 public:

+ 1 - 0
server/CGameHandler.cpp

@@ -924,6 +924,7 @@ void CGameHandler::endBattleConfirm(const BattleInfo * battleInfo)
 	raccepted.exp[1] = battleResult.data->exp[1];
 	sendAndApply(&raccepted);
 
+	queries.popIfTop(battleQuery);
 	//--> continuation (battleAfterLevelUp) occurs after level-up queries are handled or on removing query
 }