diff options
author | Johannes Schickel | 2009-05-22 22:43:13 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-05-22 22:43:13 +0000 |
commit | 017bb21945f91a0f3459ccc7c7eac6608082acf3 (patch) | |
tree | 3c4f92f12b001865e5b0e8410acfd847503e7697 /engines | |
parent | 89d4bcbf265533f51cfe9ed9ee82c96956acbf65 (diff) | |
download | scummvm-rg350-017bb21945f91a0f3459ccc7c7eac6608082acf3.tar.gz scummvm-rg350-017bb21945f91a0f3459ccc7c7eac6608082acf3.tar.bz2 scummvm-rg350-017bb21945f91a0f3459ccc7c7eac6608082acf3.zip |
Change button list handling to closer match original. This fixes a crash when loading via GMM.
svn-id: r40793
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/gui_lol.cpp | 21 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/lol.h | 1 |
3 files changed, 10 insertions, 13 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index f2a8b3bd6f..6c36ffb3fc 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -858,11 +858,8 @@ void LoLEngine::gui_enableCharInventoryButtons(int charNum) { } void LoLEngine::gui_resetButtonList() { - while (_activeButtons) { - Button *n = _activeButtons->nextButton; - delete _activeButtons; - _activeButtons = n; - } + for (uint i = 0; i < ARRAYSIZE(_activeButtonData); ++i) + _activeButtonData[i].nextButton = 0; gui_notifyButtonListChanged(); _activeButtons = 0; @@ -904,25 +901,25 @@ void LoLEngine::gui_initMagicSubmenu(int charNum) { } void LoLEngine::gui_initButton(int index, int x, int y, int val) { - Button *b = new Button; - memset(b, 0, sizeof(Button)); - + Button *b = 0; int cnt = 1; if (_activeButtons) { - cnt++; Button *n = _activeButtons; - while (n->nextButton) { + ++cnt; n = n->nextButton; - cnt++; } - n->nextButton = b; + ++cnt; + b = n->nextButton = &_activeButtonData[cnt]; } else { + b = &_activeButtonData[0]; _activeButtons = b; } + *b = Button(); + b->data0Val2 = b->data1Val2 = b->data2Val2 = 0xfe; b->data0Val3 = b->data1Val3 = b->data2Val3 = 0x01; diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 9125038bf1..04f528f1f5 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -246,7 +246,6 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy LoLEngine::~LoLEngine() { setupPrologueData(false); - gui_resetButtonList(); delete[] _landsFile; delete[] _levelLangFile; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index e5d513d75f..cd779b53f9 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -497,6 +497,7 @@ private: Common::Array<Button::Callback> _buttonCallbacks; Button *_activeButtons; + Button _activeButtonData[70]; ButtonDef _sceneWindowButton; bool _preserveEvents; |