Browse Source

Revert "Single player spectator"

This reverts commit b9e5e426473912682531bfa6fbdb532c4038e3ef.
nordsoft 2 years ago
parent
commit
413870d39a
3 changed files with 4 additions and 6 deletions
  1. 1 1
      client/CMT.cpp
  2. 2 4
      client/Client.cpp
  3. 1 1
      client/NetPacksClient.cpp

+ 1 - 1
client/CMT.cpp

@@ -178,7 +178,7 @@ int main(int argc, char * argv[])
 		("spectate-ignore-hero", "wont follow heroes on adventure map")
 		("spectate-ignore-hero", "wont follow heroes on adventure map")
 		("spectate-hero-speed", po::value<int>(), "hero movement speed on adventure map")
 		("spectate-hero-speed", po::value<int>(), "hero movement speed on adventure map")
 		("spectate-battle-speed", po::value<int>(), "battle animation speed for spectator")
 		("spectate-battle-speed", po::value<int>(), "battle animation speed for spectator")
-		("spectate-skip-battle", "skip AI battles in spectator view")
+		("spectate-skip-battle", "skip battles in spectator view")
 		("spectate-skip-battle-result", "skip battle result window")
 		("spectate-skip-battle-result", "skip battle result window")
 		("onlyAI", "allow to run without human player, all players will be default AI")
 		("onlyAI", "allow to run without human player, all players will be default AI")
 		("headless", "runs without GUI, implies --onlyAI")
 		("headless", "runs without GUI, implies --onlyAI")

+ 2 - 4
client/Client.cpp

@@ -415,9 +415,7 @@ void CClient::initPlayerEnvironments()
 	{
 	{
 		Settings session = settings.write["session"];
 		Settings session = settings.write["session"];
 		session["spectate"].Bool() = true;
 		session["spectate"].Bool() = true;
-		session["spectate-skip-battle"].Bool() = true;
 		session["spectate-skip-battle-result"].Bool() = true;
 		session["spectate-skip-battle-result"].Bool() = true;
-		session["spectate-ignore-hero"].Bool() = true;
 	}
 	}
 	
 	
 	if(settings["session"]["spectate"].Bool())
 	if(settings["session"]["spectate"].Bool())
@@ -579,7 +577,7 @@ void CClient::battleStarted(const BattleInfo * info)
 	callBattleStart(leftSide.color, 0);
 	callBattleStart(leftSide.color, 0);
 	callBattleStart(rightSide.color, 1);
 	callBattleStart(rightSide.color, 1);
 	callBattleStart(PlayerColor::UNFLAGGABLE, 1);
 	callBattleStart(PlayerColor::UNFLAGGABLE, 1);
-	if(settings["session"]["spectate"].Bool())
+	if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
 		callBattleStart(PlayerColor::SPECTATOR, 1);
 		callBattleStart(PlayerColor::SPECTATOR, 1);
 	
 	
 	if(vstd::contains(playerint, leftSide.color) && playerint[leftSide.color]->human)
 	if(vstd::contains(playerint, leftSide.color) && playerint[leftSide.color]->human)
@@ -604,7 +602,7 @@ void CClient::battleStarted(const BattleInfo * info)
 			boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
 			boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
 			CPlayerInterface::battleInt = std::make_shared<BattleInterface>(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero, att, def);
 			CPlayerInterface::battleInt = std::make_shared<BattleInterface>(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero, att, def);
 		}
 		}
-		else if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
+		else if(false && settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
 		{
 		{
 			//spectator for AI-only battles
 			//spectator for AI-only battles
 			//TODO: This certainly need improvement
 			//TODO: This certainly need improvement

+ 1 - 1
client/NetPacksClient.cpp

@@ -97,7 +97,7 @@ void callBattleInterfaceIfPresentForBothSides(CClient & cl, void (T::*ptr)(Args.
 {
 {
 	callOnlyThatBattleInterface(cl, cl.gameState()->curB->sides[0].color, ptr, std::forward<Args2>(args)...);
 	callOnlyThatBattleInterface(cl, cl.gameState()->curB->sides[0].color, ptr, std::forward<Args2>(args)...);
 	callOnlyThatBattleInterface(cl, cl.gameState()->curB->sides[1].color, ptr, std::forward<Args2>(args)...);
 	callOnlyThatBattleInterface(cl, cl.gameState()->curB->sides[1].color, ptr, std::forward<Args2>(args)...);
-	if(LOCPLINT->battleInt && settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
+	if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool() && LOCPLINT->battleInt)
 	{
 	{
 		callOnlyThatBattleInterface(cl, PlayerColor::SPECTATOR, ptr, std::forward<Args2>(args)...);
 		callOnlyThatBattleInterface(cl, PlayerColor::SPECTATOR, ptr, std::forward<Args2>(args)...);
 	}
 	}