diff options
author | athrxx | 2019-12-07 19:55:37 +0100 |
---|---|---|
committer | athrxx | 2019-12-18 20:50:46 +0100 |
commit | c172e047d6add9583dbee9d295954614cf456b86 (patch) | |
tree | bb39736a6f9bab849d15d5f2fdd5c2b865f4cbf2 /engines/kyra/graphics/screen.cpp | |
parent | f446242215d55af1fe6151aa9f9f3fc4ce11a8d7 (diff) | |
download | scummvm-rg350-c172e047d6add9583dbee9d295954614cf456b86.tar.gz scummvm-rg350-c172e047d6add9583dbee9d295954614cf456b86.tar.bz2 scummvm-rg350-c172e047d6add9583dbee9d295954614cf456b86.zip |
KYRA: cleanup screen class destruction
Object now destructs cleanly even before init() has been called. This has no practical relevance, but should be fixed nonetheless.
Diffstat (limited to 'engines/kyra/graphics/screen.cpp')
-rw-r--r-- | engines/kyra/graphics/screen.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp index cd8f9404cc..d9ebb4ff88 100644 --- a/engines/kyra/graphics/screen.cpp +++ b/engines/kyra/graphics/screen.cpp @@ -52,10 +52,14 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co memset(_pagePtrs, 0, sizeof(_pagePtrs)); memset(_pageMapping, 0, sizeof(_pageMapping)); + memset(_sjisOverlayPtrs, 0, sizeof(_sjisOverlayPtrs)); _renderMode = Common::kRenderDefault; _sjisMixedFontMode = false; + _screenPalette = _internFadePalette = 0; + _animBlockPtr = _decodeShapeBuffer = 0; + _useHiColorScreen = _vm->gameFlags().useHiColorMode; _use256ColorMode = true; _screenPageSize = SCREEN_PAGE_SIZE; @@ -69,6 +73,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co _currentFontType = FTYPE_ASCII; _paletteChanged = true; _textMarginRight = SCREEN_W; + _customDimTable = 0; _curDim = 0; } @@ -91,15 +96,15 @@ Screen::~Screen() { for (uint i = 0; i < _palettes.size(); ++i) delete _palettes[i]; - for (int i = 0; i < _dimTableCount; ++i) - delete _customDimTable[i]; - delete[] _customDimTable; + if (_customDimTable) { + for (int i = 0; i < _dimTableCount; ++i) + delete _customDimTable[i]; + delete[] _customDimTable; + } } bool Screen::init() { _debugEnabled = false; - - memset(_sjisOverlayPtrs, 0, sizeof(_sjisOverlayPtrs)); _useOverlays = false; _useSJIS = false; _use16ColorMode = _vm->gameFlags().use16ColorMode; |