Prechádzať zdrojové kódy

Single player spectator

nordsoft 2 rokov pred
rodič
commit
b9e5e42647
3 zmenil súbory, kde vykonal 6 pridanie a 4 odobranie
  1. 1 1
      client/CMT.cpp
  2. 4 2
      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-hero-speed", po::value<int>(), "hero movement speed on adventure map")
 		("spectate-battle-speed", po::value<int>(), "battle animation speed for spectator")
-		("spectate-skip-battle", "skip battles in spectator view")
+		("spectate-skip-battle", "skip AI battles in spectator view")
 		("spectate-skip-battle-result", "skip battle result window")
 		("onlyAI", "allow to run without human player, all players will be default AI")
 		("headless", "runs without GUI, implies --onlyAI")

+ 4 - 2
client/Client.cpp

@@ -415,7 +415,9 @@ void CClient::initPlayerEnvironments()
 	{
 		Settings session = settings.write["session"];
 		session["spectate"].Bool() = true;
+		session["spectate-skip-battle"].Bool() = true;
 		session["spectate-skip-battle-result"].Bool() = true;
+		session["spectate-ignore-hero"].Bool() = true;
 	}
 	
 	if(settings["session"]["spectate"].Bool())
@@ -577,7 +579,7 @@ void CClient::battleStarted(const BattleInfo * info)
 	callBattleStart(leftSide.color, 0);
 	callBattleStart(rightSide.color, 1);
 	callBattleStart(PlayerColor::UNFLAGGABLE, 1);
-	if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
+	if(settings["session"]["spectate"].Bool())
 		callBattleStart(PlayerColor::SPECTATOR, 1);
 	
 	if(vstd::contains(playerint, leftSide.color) && playerint[leftSide.color]->human)
@@ -602,7 +604,7 @@ void CClient::battleStarted(const BattleInfo * info)
 			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);
 		}
-		else if(false && settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
+		else if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
 		{
 			//spectator for AI-only battles
 			//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[1].color, ptr, std::forward<Args2>(args)...);
-	if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool() && LOCPLINT->battleInt)
+	if(LOCPLINT->battleInt && settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
 	{
 		callOnlyThatBattleInterface(cl, PlayerColor::SPECTATOR, ptr, std::forward<Args2>(args)...);
 	}