mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
battle only basic implementation
This commit is contained in:
@@ -3478,6 +3478,16 @@ void CGameHandler::checkVictoryLossConditionsForPlayer(PlayerColor player)
|
||||
|
||||
if(!p || p->status != EPlayerStatus::INGAME) return;
|
||||
|
||||
if(gameState().getMap().battleOnly)
|
||||
{
|
||||
PlayerEndsGame peg;
|
||||
peg.player = player;
|
||||
peg.silentEnd = true;
|
||||
sendAndApply(peg);
|
||||
gameServer().setState(EServerState::SHUTDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
auto victoryLossCheckResult = gameState().checkForVictoryAndLoss(player);
|
||||
|
||||
if (victoryLossCheckResult.victory() || victoryLossCheckResult.loss())
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "../../lib/CPlayerState.h"
|
||||
#include "../../lib/mapping/CMap.h"
|
||||
#include "../../lib/mapObjects/CGObjectInstance.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
#include "../../lib/gameState/CGameState.h"
|
||||
#include "../../lib/pathfinder/CPathfinder.h"
|
||||
#include "../../lib/pathfinder/PathfinderOptions.h"
|
||||
@@ -364,6 +365,15 @@ bool TurnOrderProcessor::onPlayerEndsTurn(PlayerColor which)
|
||||
|
||||
void TurnOrderProcessor::onGameStarted()
|
||||
{
|
||||
if(gameHandler->gameInfo().getMapHeader()->battleOnly)
|
||||
{
|
||||
auto heroes = gameHandler->gameState().getMap().getObjects<CGHeroInstance>();
|
||||
auto hero1 = heroes.at(0);
|
||||
auto hero2 = heroes.at(1);
|
||||
gameHandler->startBattle(hero1, hero2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (actingPlayers.empty())
|
||||
blockedContacts = computeContactStatus();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user