2017-07-13 10:26:03 +02:00
|
|
|
/*
|
2023-02-01 16:42:03 +02:00
|
|
|
* CAdventureOptions.cpp, part of VCMI engine
|
2017-07-13 10:26:03 +02:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2023-02-01 20:42:06 +02:00
|
|
|
|
2011-12-14 00:23:17 +03:00
|
|
|
#include "StdInc.h"
|
2023-02-01 20:42:06 +02:00
|
|
|
#include "CAdventureOptions.h"
|
2011-12-14 00:23:17 +03:00
|
|
|
|
2023-02-01 20:42:06 +02:00
|
|
|
#include "CAdvMapInt.h"
|
2014-07-13 20:53:37 +03:00
|
|
|
|
|
|
|
#include "../CGameInfo.h"
|
|
|
|
#include "../CPlayerInterface.h"
|
2022-04-26 13:14:31 +02:00
|
|
|
#include "../lobby/CCampaignInfoScreen.h"
|
2018-01-05 19:21:07 +02:00
|
|
|
#include "../lobby/CScenarioInfoScreen.h"
|
2014-07-13 20:53:37 +03:00
|
|
|
#include "../gui/CGuiHandler.h"
|
2023-02-01 20:42:06 +02:00
|
|
|
#include "../widgets/Buttons.h"
|
2014-07-13 20:53:37 +03:00
|
|
|
|
|
|
|
#include "../../CCallback.h"
|
2018-01-05 19:21:07 +02:00
|
|
|
#include "../../lib/StartInfo.h"
|
2009-01-12 22:05:56 +02:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
CAdventureOptions::CAdventureOptions()
|
|
|
|
: CWindowObject(PLAYER_COLORED, "ADVOPTS")
|
2009-08-27 11:04:32 +03:00
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
viewWorld = std::make_shared<CButton>(Point(24, 23), "ADVVIEW.DEF", CButton::tooltip(), [&](){ close(); }, SDLK_v);
|
2015-01-13 21:57:41 +02:00
|
|
|
viewWorld->addCallback(std::bind(&CPlayerInterface::viewWorldMap, LOCPLINT));
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
exit = std::make_shared<CButton>(Point(204, 313), "IOK6432.DEF", CButton::tooltip(), std::bind(&CAdventureOptions::close, this), SDLK_RETURN);
|
2014-07-15 10:14:49 +03:00
|
|
|
exit->assignedKeys.insert(SDLK_ESCAPE);
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
scenInfo = std::make_shared<CButton>(Point(24, 198), "ADVINFO.DEF", CButton::tooltip(), [&](){ close(); }, SDLK_i);
|
2014-08-03 14:16:19 +03:00
|
|
|
scenInfo->addCallback(CAdventureOptions::showScenarioInfo);
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
puzzle = std::make_shared<CButton>(Point(24, 81), "ADVPUZ.DEF", CButton::tooltip(), [&](){ close(); }, SDLK_p);
|
2014-08-09 15:14:31 +03:00
|
|
|
puzzle->addCallback(std::bind(&CPlayerInterface::showPuzzleMap, LOCPLINT));
|
2014-07-15 10:14:49 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
dig = std::make_shared<CButton>(Point(24, 139), "ADVDIG.DEF", CButton::tooltip(), [&](){ close(); }, SDLK_d);
|
2014-07-15 10:14:49 +03:00
|
|
|
if(const CGHeroInstance *h = adventureInt->curHero())
|
2014-08-09 15:14:31 +03:00
|
|
|
dig->addCallback(std::bind(&CPlayerInterface::tryDiggging, LOCPLINT, h));
|
2010-02-24 15:03:36 +02:00
|
|
|
else
|
|
|
|
dig->block(true);
|
2009-08-27 11:04:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CAdventureOptions::showScenarioInfo()
|
|
|
|
{
|
2018-01-05 19:21:07 +02:00
|
|
|
if(LOCPLINT->cb->getStartInfo()->campState)
|
2013-12-16 21:39:56 +03:00
|
|
|
{
|
2022-04-26 13:14:31 +02:00
|
|
|
GH.pushIntT<CCampaignInfoScreen>();
|
2013-12-16 21:39:56 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-07-25 00:36:48 +02:00
|
|
|
GH.pushIntT<CScenarioInfoScreen>();
|
2013-12-16 21:39:56 +03:00
|
|
|
}
|
2010-10-31 00:53:41 +03:00
|
|
|
}
|
2015-02-02 14:02:27 +02:00
|
|
|
|