1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-24 00:36:29 +02:00

Remove code related to duel mode (#312)

Remove code related to duel mode
This commit is contained in:
ArseniyShestakov
2017-07-01 16:30:13 +03:00
committed by GitHub
parent 7bc9853175
commit 2f305cc68d
13 changed files with 63 additions and 459 deletions

View File

@@ -450,47 +450,24 @@ void CClient::newGame( CConnection *con, StartInfo *si )
continue;
logNetwork->traceStream() << "Preparing interface for player " << color;
if(si->mode != StartInfo::DUEL)
if(elem.second.playerID == PlayerSettings::PLAYER_AI)
{
if(elem.second.playerID == PlayerSettings::PLAYER_AI)
{
auto AiToGive = aiNameForPlayer(elem.second, false);
logNetwork->infoStream() << boost::format("Player %s will be lead by %s") % color % AiToGive;
installNewPlayerInterface(CDynLibHandler::getNewAI(AiToGive), color);
}
else
{
installNewPlayerInterface(std::make_shared<CPlayerInterface>(color), color);
humanPlayers++;
}
auto AiToGive = aiNameForPlayer(elem.second, false);
logNetwork->info("Player %s will be lead by %s", color, AiToGive);
installNewPlayerInterface(CDynLibHandler::getNewAI(AiToGive), color);
}
else
{
std::string AItoGive = aiNameForPlayer(elem.second, true);
installNewBattleInterface(CDynLibHandler::getNewBattleAI(AItoGive), color);
installNewPlayerInterface(std::make_shared<CPlayerInterface>(color), color);
humanPlayers++;
}
}
if(si->mode == StartInfo::DUEL)
if(settings["session"]["spectate"].Bool())
{
if(!settings["session"]["headless"].Bool())
{
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
auto p = std::make_shared<CPlayerInterface>(PlayerColor::NEUTRAL);
p->observerInDuelMode = true;
installNewPlayerInterface(p, boost::none);
GH.curInt = p.get();
}
battleStarted(gs->curB);
}
else
{
if(settings["session"]["spectate"].Bool())
{
installNewPlayerInterface(std::make_shared<CPlayerInterface>(PlayerColor::SPECTATOR), PlayerColor::SPECTATOR, true);
}
loadNeutralBattleAI();
installNewPlayerInterface(std::make_shared<CPlayerInterface>(PlayerColor::SPECTATOR), PlayerColor::SPECTATOR, true);
}
loadNeutralBattleAI();
serv->addStdVecItems(gs);
hotSeat = (humanPlayers > 1);
@@ -777,7 +754,7 @@ void CClient::battleStarted(const BattleInfo * info)
if(!settings["session"]["headless"].Bool())
{
if(!!att || !!def || gs->scenarioOps->mode == StartInfo::DUEL)
if(!!att || !!def)
{
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
auto bi = new CBattleInterface(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero,