CScenarioInfoScreen.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * CScenarioInfoScreen.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CScenarioInfoScreen.h"
  12. #include "OptionsTab.h"
  13. #include "../CGameInfo.h"
  14. #include "../CPlayerInterface.h"
  15. #include "../gui/CGuiHandler.h"
  16. #include "../gui/Shortcut.h"
  17. #include "../widgets/Buttons.h"
  18. #include "../../CCallback.h"
  19. #include "../../lib/CGeneralTextHandler.h"
  20. #include "../../lib/StartInfo.h"
  21. #include "../../lib/mapping/CMapInfo.h"
  22. CScenarioInfoScreen::CScenarioInfoScreen()
  23. {
  24. OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
  25. pos.w = 800;
  26. pos.h = 600;
  27. pos = center();
  28. localSi = new StartInfo(*LOCPLINT->cb->getStartInfo());
  29. localMi = new CMapInfo();
  30. localMi->mapHeader = std::unique_ptr<CMapHeader>(new CMapHeader(*LOCPLINT->cb->getMapHeader()));
  31. screenType = ESelectionScreen::scenarioInfo;
  32. card = std::make_shared<InfoCard>();
  33. opt = std::make_shared<OptionsTab>();
  34. opt->recActions = UPDATE | SHOWALL;
  35. opt->recreate();
  36. card->changeSelection();
  37. card->iconDifficulty->setSelected(getCurrentDifficulty());
  38. buttonBack = std::make_shared<CButton>(Point(584, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], [=](){ close();}, EShortcut::GLOBAL_CANCEL);
  39. }
  40. CScenarioInfoScreen::~CScenarioInfoScreen()
  41. {
  42. vstd::clear_pointer(localSi);
  43. vstd::clear_pointer(localMi);
  44. }
  45. const CMapInfo * CScenarioInfoScreen::getMapInfo()
  46. {
  47. return localMi;
  48. }
  49. const StartInfo * CScenarioInfoScreen::getStartInfo()
  50. {
  51. return localSi;
  52. }