1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Removed creatureBank flag from battle, battles now receive BattleLayout

struct that defines how units are placed in combat
This commit is contained in:
Ivan Savenko
2024-08-31 21:04:32 +00:00
parent c55e07dabc
commit 39a2c29c97
34 changed files with 341 additions and 258 deletions

View File

@@ -14,6 +14,7 @@
#include "../CPlayerState.h"
#include "../GameSettings.h"
#include "../IGameCallback.h"
#include "../battle/BattleLayout.h"
#include "../gameState/CGameState.h"
#include "../mapObjectConstructors/AObjectTypeHandler.h"
#include "../mapObjectConstructors/CObjectClassesHandler.h"
@@ -127,7 +128,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *hero) const
bd.text = guardedReward.message;
bd.components = getPopupComponents(hero->getOwner());
cb->showBlockingDialog(&bd);
cb->showBlockingDialog(this, &bd);
}
else
{
@@ -238,7 +239,10 @@ void CRewardableObject::blockingDialogAnswered(const CGHeroInstance * hero, int3
if(guardedPresently())
{
if (answer)
cb->startBattleI(hero, this, true);
{
auto layout = BattleLayout::createLayout(cb, configuration.guardsLayout, hero, this);
cb->startBattle(hero, this, visitablePos(), hero, nullptr, layout, nullptr);
}
}
else
{
@@ -405,7 +409,7 @@ std::vector<Component> CRewardableObject::getPopupComponentsImpl(PlayerColor pla
if (guardedPresently())
{
if (!VLC->settings()->getBoolean(EGameSettings::BANKS_SHOW_GUARDS_COMPOSITION))
if (!cb->getSettings().getBoolean(EGameSettings::BANKS_SHOW_GUARDS_COMPOSITION))
return {};
std::map<CreatureID, int> guardsAmounts;