1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00

Merge pull request #4134 from kambala-decapitator/editor-fix-crash-on-exit

[editor] fix crash on quit
This commit is contained in:
Ivan Savenko
2024-06-17 17:25:12 +03:00
committed by GitHub
6 changed files with 15 additions and 11 deletions

View File

@ -207,13 +207,13 @@ class DLL_LINKAGE CMapHeader
void setupEvents(); void setupEvents();
public: public:
static const int MAP_SIZE_SMALL = 36; static constexpr int MAP_SIZE_SMALL = 36;
static const int MAP_SIZE_MIDDLE = 72; static constexpr int MAP_SIZE_MIDDLE = 72;
static const int MAP_SIZE_LARGE = 108; static constexpr int MAP_SIZE_LARGE = 108;
static const int MAP_SIZE_XLARGE = 144; static constexpr int MAP_SIZE_XLARGE = 144;
static const int MAP_SIZE_HUGE = 180; static constexpr int MAP_SIZE_HUGE = 180;
static const int MAP_SIZE_XHUGE = 216; static constexpr int MAP_SIZE_XHUGE = 216;
static const int MAP_SIZE_GIANT = 252; static constexpr int MAP_SIZE_GIANT = 252;
CMapHeader(); CMapHeader();
virtual ~CMapHeader(); virtual ~CMapHeader();

View File

@ -8,6 +8,7 @@
* *
*/ */
#include "StdInc.h"
#include "mapcontroller.h" #include "mapcontroller.h"
#include "../lib/ArtifactUtils.h" #include "../lib/ArtifactUtils.h"
@ -57,6 +58,7 @@ void MapController::connectScenes()
MapController::~MapController() MapController::~MapController()
{ {
main = nullptr;
} }
const std::unique_ptr<CMap> & MapController::getMapUniquePtr() const const std::unique_ptr<CMap> & MapController::getMapUniquePtr() const
@ -228,6 +230,8 @@ void MapController::setMap(std::unique_ptr<CMap> cmap)
_map->getEditManager()->getUndoManager().setUndoCallback([this](bool allowUndo, bool allowRedo) _map->getEditManager()->getUndoManager().setUndoCallback([this](bool allowUndo, bool allowRedo)
{ {
if(!main)
return;
main->enableUndo(allowUndo); main->enableUndo(allowUndo);
main->enableRedo(allowRedo); main->enableRedo(allowRedo);
} }

View File

@ -11,7 +11,6 @@
#pragma once #pragma once
//code is copied from vcmiclient/mapHandler.h with minimal changes //code is copied from vcmiclient/mapHandler.h with minimal changes
#include "StdInc.h"
#include "../lib/int3.h" #include "../lib/int3.h"
#include "Animation.h" #include "Animation.h"

View File

@ -10,7 +10,6 @@
#pragma once #pragma once
#include "StdInc.h"
#include <QDialog> #include <QDialog>
#include "playerparams.h" #include "playerparams.h"

View File

@ -108,7 +108,7 @@ bool WindowNewMap::loadUserSettings()
ui->widthTxt->setText(QString::number(mapGenOptions.getWidth())); ui->widthTxt->setText(QString::number(mapGenOptions.getWidth()));
ui->heightTxt->setText(QString::number(mapGenOptions.getHeight())); ui->heightTxt->setText(QString::number(mapGenOptions.getHeight()));
for(auto & sz : mapSizes) for(const auto & sz : mapSizes)
{ {
if(sz.second.first == mapGenOptions.getWidth() && if(sz.second.first == mapGenOptions.getWidth() &&
sz.second.second == mapGenOptions.getHeight()) sz.second.second == mapGenOptions.getHeight())

View File

@ -11,6 +11,8 @@
#pragma once #pragma once
#include <QDialog> #include <QDialog>
#include "../lib/mapping/CMapHeader.h"
#include "../lib/rmg/CMapGenOptions.h" #include "../lib/rmg/CMapGenOptions.h"
namespace Ui namespace Ui