From 0e925e97554aae573e895afa4e3d8450f01df342 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 15 Nov 2007 23:44:01 +0000 Subject: Moved item icon from ItemInfo class to the Item class, so that it can be loaded on demand. Results in faster startup time and reduced memory usage. --- src/gui/equipmentwindow.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/gui/equipmentwindow.cpp') diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 20cc86e7..9a96b4d6 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -102,11 +102,11 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) for (int i = 0; i < EQUIPMENT_SIZE; i++) { - int itemId = mEquipment->getEquipment(i); - if (itemId) + Item *item = mEquipment->getEquipment(i); + if (item) { // Draw Item. - Image *image = Item(itemId).getInfo().getImage(); + Image *image = item->getImage(); g->drawImage(image, mEquipBox[i].posX, mEquipBox[i].posY); } @@ -149,8 +149,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) BOX_WIDTH, BOX_HEIGHT); if (tRect.isPointInRect(x, y)) { - int itemId = mEquipment->getEquipment(i); - if (itemId) + if (mEquipment->getEquipment(i)) { mSelected = i; } -- cgit v1.2.3-70-g09d2