mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Fix crash when clicking scenario info during campaign gameplay.
This commit is contained in:
parent
d17f1980d4
commit
1e97859fbf
@ -49,6 +49,7 @@ set(client_SRCS
|
|||||||
lobby/CLobbyScreen.cpp
|
lobby/CLobbyScreen.cpp
|
||||||
lobby/CSavingScreen.cpp
|
lobby/CSavingScreen.cpp
|
||||||
lobby/CScenarioInfoScreen.cpp
|
lobby/CScenarioInfoScreen.cpp
|
||||||
|
lobby/CCampaignInfoScreen.cpp
|
||||||
lobby/OptionsTab.cpp
|
lobby/OptionsTab.cpp
|
||||||
lobby/RandomMapTab.cpp
|
lobby/RandomMapTab.cpp
|
||||||
lobby/SelectionTab.cpp
|
lobby/SelectionTab.cpp
|
||||||
@ -121,6 +122,7 @@ set(client_HEADERS
|
|||||||
lobby/CLobbyScreen.h
|
lobby/CLobbyScreen.h
|
||||||
lobby/CSavingScreen.h
|
lobby/CSavingScreen.h
|
||||||
lobby/CScenarioInfoScreen.h
|
lobby/CScenarioInfoScreen.h
|
||||||
|
lobby/CCampaignInfoScreen.h
|
||||||
lobby/OptionsTab.h
|
lobby/OptionsTab.h
|
||||||
lobby/RandomMapTab.h
|
lobby/RandomMapTab.h
|
||||||
lobby/SelectionTab.h
|
lobby/SelectionTab.h
|
||||||
|
@ -360,6 +360,8 @@ void CBonusSelection::updateAfterStateChange()
|
|||||||
buttonStart->disable();
|
buttonStart->disable();
|
||||||
buttonRestart->enable();
|
buttonRestart->enable();
|
||||||
buttonBack->block(false);
|
buttonBack->block(false);
|
||||||
|
buttonDifficultyLeft->disable();
|
||||||
|
buttonDifficultyRight->disable();
|
||||||
}
|
}
|
||||||
if(CSH->campaignBonus == -1)
|
if(CSH->campaignBonus == -1)
|
||||||
{
|
{
|
||||||
@ -449,7 +451,7 @@ void CBonusSelection::restartMap()
|
|||||||
close();
|
close();
|
||||||
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]()
|
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]()
|
||||||
{
|
{
|
||||||
CSH->startCampaignScenario();
|
LOCPLINT->sendCustomEvent(EUserEvent::RESTART_GAME);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ class CToggleGroup;
|
|||||||
class CAnimImage;
|
class CAnimImage;
|
||||||
class CLabel;
|
class CLabel;
|
||||||
class CFlagBox;
|
class CFlagBox;
|
||||||
|
class ISelectionScreenInfo;
|
||||||
|
|
||||||
/// Campaign screen where you can choose one out of three starting bonuses
|
/// Campaign screen where you can choose one out of three starting bonuses
|
||||||
class CBonusSelection : public CWindowObject
|
class CBonusSelection : public CWindowObject
|
||||||
@ -89,4 +90,4 @@ public:
|
|||||||
std::shared_ptr<CButton> buttonDifficultyLeft;
|
std::shared_ptr<CButton> buttonDifficultyLeft;
|
||||||
std::shared_ptr<CButton> buttonDifficultyRight;
|
std::shared_ptr<CButton> buttonDifficultyRight;
|
||||||
std::shared_ptr<CAnimImage> iconsMapSizes;
|
std::shared_ptr<CAnimImage> iconsMapSizes;
|
||||||
};
|
};
|
49
client/lobby/CCampaignInfoScreen.cpp
Normal file
49
client/lobby/CCampaignInfoScreen.cpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* CCampaignInfoScreen.cpp, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "StdInc.h"
|
||||||
|
|
||||||
|
#include "CCampaignInfoScreen.h"
|
||||||
|
|
||||||
|
#include "../../CCallback.h"
|
||||||
|
#include "../../lib/CGeneralTextHandler.h"
|
||||||
|
#include "../../lib/StartInfo.h"
|
||||||
|
#include "../../lib/mapping/CMapInfo.h"
|
||||||
|
#include "../gui/CAnimation.h"
|
||||||
|
#include "../gui/CGuiHandler.h"
|
||||||
|
#include "../CGameInfo.h"
|
||||||
|
#include "../CMessage.h"
|
||||||
|
#include "../CPlayerInterface.h"
|
||||||
|
|
||||||
|
CCampaignInfoScreen::CCampaignInfoScreen()
|
||||||
|
{
|
||||||
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
|
localSi = new StartInfo(*LOCPLINT->cb->getStartInfo());
|
||||||
|
localMi = new CMapInfo();
|
||||||
|
localMi->mapHeader = std::unique_ptr<CMapHeader>(new CMapHeader(*LOCPLINT->cb->getMapHeader()));
|
||||||
|
|
||||||
|
screenType = ESelectionScreen::scenarioInfo;
|
||||||
|
|
||||||
|
updateAfterStateChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCampaignInfoScreen::~CCampaignInfoScreen()
|
||||||
|
{
|
||||||
|
vstd::clear_pointer(localSi);
|
||||||
|
vstd::clear_pointer(localMi);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CMapInfo * CCampaignInfoScreen::getMapInfo()
|
||||||
|
{
|
||||||
|
return localMi;
|
||||||
|
}
|
||||||
|
const StartInfo * CCampaignInfoScreen::getStartInfo()
|
||||||
|
{
|
||||||
|
return localSi;
|
||||||
|
}
|
26
client/lobby/CCampaignInfoScreen.h
Normal file
26
client/lobby/CCampaignInfoScreen.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* CCampaignInfoScreen.h, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CSelectionBase.h"
|
||||||
|
#include "CBonusSelection.h"
|
||||||
|
|
||||||
|
class CCampaignInfoScreen : public CBonusSelection, ISelectionScreenInfo
|
||||||
|
{
|
||||||
|
const StartInfo * localSi;
|
||||||
|
CMapInfo * localMi;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CCampaignInfoScreen();
|
||||||
|
~CCampaignInfoScreen();
|
||||||
|
|
||||||
|
const CMapInfo * getMapInfo() override;
|
||||||
|
const StartInfo * getStartInfo() override;
|
||||||
|
};
|
@ -23,7 +23,8 @@
|
|||||||
#include "../CMusicHandler.h"
|
#include "../CMusicHandler.h"
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
#include "../mainmenu/CMainMenu.h"
|
#include "../mainmenu/CMainMenu.h"
|
||||||
#include "../lobby/CBonusSelection.h"
|
#include "../lobby/CSelectionBase.h"
|
||||||
|
#include "../lobby/CCampaignInfoScreen.h"
|
||||||
#include "../lobby/CSavingScreen.h"
|
#include "../lobby/CSavingScreen.h"
|
||||||
#include "../lobby/CScenarioInfoScreen.h"
|
#include "../lobby/CScenarioInfoScreen.h"
|
||||||
#include "../Graphics.h"
|
#include "../Graphics.h"
|
||||||
@ -51,6 +52,7 @@
|
|||||||
#include "../../lib/UnlockGuard.h"
|
#include "../../lib/UnlockGuard.h"
|
||||||
#include "../../lib/VCMI_Lib.h"
|
#include "../../lib/VCMI_Lib.h"
|
||||||
#include "../../lib/StartInfo.h"
|
#include "../../lib/StartInfo.h"
|
||||||
|
#include "../../lib/mapping/CMapInfo.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning (disable : 4355)
|
#pragma warning (disable : 4355)
|
||||||
@ -1964,7 +1966,7 @@ void CAdventureOptions::showScenarioInfo()
|
|||||||
{
|
{
|
||||||
if(LOCPLINT->cb->getStartInfo()->campState)
|
if(LOCPLINT->cb->getStartInfo()->campState)
|
||||||
{
|
{
|
||||||
GH.pushIntT<CBonusSelection>();
|
GH.pushIntT<CCampaignInfoScreen>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user