[Scummvm-cvs-logs] SF.net SVN: scummvm:[40793] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat May 23 00:43:13 CEST 2009


Revision: 40793
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40793&view=rev
Author:   lordhoto
Date:     2009-05-22 22:43:13 +0000 (Fri, 22 May 2009)

Log Message:
-----------
Change button list handling to closer match original. This fixes a crash when loading via GMM.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/lol.h

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-05-22 22:32:57 UTC (rev 40792)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-05-22 22:43:13 UTC (rev 40793)
@@ -858,11 +858,8 @@
 }
 
 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_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;
 

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-05-22 22:32:57 UTC (rev 40792)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-05-22 22:43:13 UTC (rev 40793)
@@ -246,7 +246,6 @@
 
 LoLEngine::~LoLEngine() {
 	setupPrologueData(false);
-	gui_resetButtonList();
 
 	delete[] _landsFile;
 	delete[] _levelLangFile;

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-05-22 22:32:57 UTC (rev 40792)
+++ scummvm/trunk/engines/kyra/lol.h	2009-05-22 22:43:13 UTC (rev 40793)
@@ -497,6 +497,7 @@
 
 	Common::Array<Button::Callback> _buttonCallbacks;
 	Button *_activeButtons;
+	Button _activeButtonData[70];
 	ButtonDef _sceneWindowButton;
 	bool _preserveEvents;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list