[Scummvm-cvs-logs] scummvm master -> de592e07f33ff8d29110ec6d592b8d6171875969

dreammaster dreammaster at scummvm.org
Sun May 1 02:36:33 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
de592e07f3 TSAGE: Bugfixes for inventory dialog display with a large number of items


Commit: de592e07f33ff8d29110ec6d592b8d6171875969
    https://github.com/scummvm/scummvm/commit/de592e07f33ff8d29110ec6d592b8d6171875969
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-04-30T17:35:03-07:00

Commit Message:
TSAGE: Bugfixes for inventory dialog display with a large number of items

Changed paths:
    engines/tsage/dialogs.cpp
    engines/tsage/dialogs.h



diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp
index b9ad7b0..b5f00bf 100644
--- a/engines/tsage/dialogs.cpp
+++ b/engines/tsage/dialogs.cpp
@@ -412,10 +412,11 @@ InventoryDialog::InventoryDialog() {
 			imgHeight = MAX(imgHeight, (int)itemSurface.getBounds().height());
 
 			// Add the item to the display list
-			_images.push_back(GfxInvImage());
-			_images[_images.size() - 1].setDetails(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
-			_images[_images.size() - 1]._invObject = invObject;
-			add(&_images[_images.size() - 1]);
+			GfxInvImage *img = new GfxInvImage();
+			_images.push_back(img);
+			img->setDetails(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
+			img->_invObject = invObject;
+			add(img);
 		}
 	}
 	assert(_images.size() > 0);
@@ -437,7 +438,7 @@ InventoryDialog::InventoryDialog() {
 			cellX = 0;
 		}
 
-		_images[idx]._bounds.moveTo(pt.x, pt.y);
+		_images[idx]->_bounds.moveTo(pt.x, pt.y);
 
 		pt.x += imgWidth + 2;
 		++cellX;
@@ -455,6 +456,11 @@ InventoryDialog::InventoryDialog() {
 	setCenter(SCREEN_CENTER_X, SCREEN_CENTER_Y);
 }
 
+InventoryDialog::~InventoryDialog() {
+	for (uint idx = 0; idx < _images.size(); ++idx)
+		delete _images[idx];
+}
+
 void InventoryDialog::execute() {
 	if ((RING_INVENTORY._selectedItem) && RING_INVENTORY._selectedItem->inInventory())
 		RING_INVENTORY._selectedItem->setCursor();
diff --git a/engines/tsage/dialogs.h b/engines/tsage/dialogs.h
index d782852..c24fa2d 100644
--- a/engines/tsage/dialogs.h
+++ b/engines/tsage/dialogs.h
@@ -105,11 +105,11 @@ public:
 
 class InventoryDialog : public ModalDialog {
 private:
-	Common::Array<GfxInvImage> _images;
+	Common::Array<GfxInvImage *> _images;
 	GfxButton _btnOk, _btnLook;
 public:
 	InventoryDialog();
-	virtual ~InventoryDialog() {}
+	virtual ~InventoryDialog();
 	void execute();
 
 	static void show();






More information about the Scummvm-git-logs mailing list