1
0
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:
Laserlicht
2025-10-18 21:43:05 +02:00
parent e81d5bc973
commit 4d37fe631b
21 changed files with 230 additions and 9 deletions

View File

@@ -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())

View File

@@ -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();