1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Moved all GUI handling from BattleInterface to BattleControlPanel

This commit is contained in:
Ivan Savenko
2022-12-21 17:02:53 +02:00
parent 6138ff1670
commit c835a84051
24 changed files with 396 additions and 377 deletions

View File

@@ -377,18 +377,18 @@ void CClient::endGame()
i.second->finish();
GH.curInt = nullptr;
{
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
logNetwork->info("Ending current game!");
removeGUI();
vstd::clear_pointer(const_cast<CGameInfo *>(CGI)->mh);
vstd::clear_pointer(gs);
logNetwork->info("Deleted mapHandler and gameState.");
}
playerint.clear();
{
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
logNetwork->info("Ending current game!");
removeGUI();
vstd::clear_pointer(const_cast<CGameInfo *>(CGI)->mh);
vstd::clear_pointer(gs);
logNetwork->info("Deleted mapHandler and gameState.");
}
playerint.clear();
battleints.clear();
battleCallbacks.clear();
playerEnvironments.clear();
@@ -586,11 +586,10 @@ void CClient::battleStarted(const BattleInfo * info)
if(!settings["session"]["headless"].Bool())
{
Rect battleIntRect((screen->w - 800)/2, (screen->h - 600)/2, 800, 600);
if(!!att || !!def)
{
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
GH.pushIntT<BattleInterface>(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero, battleIntRect, att, def);
CPlayerInterface::battleInt = std::make_shared<BattleInterface>(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero, att, def);
}
else if(settings["session"]["spectate"].Bool() && !settings["session"]["spectate-skip-battle"].Bool())
{
@@ -598,7 +597,7 @@ void CClient::battleStarted(const BattleInfo * info)
auto spectratorInt = std::dynamic_pointer_cast<CPlayerInterface>(playerint[PlayerColor::SPECTATOR]);
spectratorInt->cb->setBattle(info);
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
GH.pushIntT<BattleInterface>(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero, battleIntRect, att, def, spectratorInt);
CPlayerInterface::battleInt = std::make_shared<BattleInterface>(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero, att, def, spectratorInt);
}
}