diff options
-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; |