summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-18 02:24:44 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-18 02:24:44 +0200
commitf8551d9ef4a745327bccb9e4cb54a22f6a28cf80 (patch)
tree9af300838e58e2e2c7aeaca5765e7dbbb30d8b6d /src/gui
parent3b7740f133e195b0a0b11090ea8c2b8a7b64411c (diff)
downloadmana-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.tar.gz
mana-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.tar.bz2
mana-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.tar.xz
mana-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.zip
Made the client able to successfully equip/unequip!
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/equipmentwindow.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index c17b5e04..d3ac82f3 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -97,26 +97,22 @@ void EquipmentWindow::action(const gcn::ActionEvent &event)
{
if (event.getId() == "unequip" && mSelected > -1)
{
- Item *item = mEquipment->getEquipment(mSelected);
- item->doEvent(Event::DoUnequip);
+ mEquipment->triggerUnequip(mSelected);
setSelected(-1);
}
}
Item *EquipmentWindow::getItem(int x, int y) const
{
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ for (int i = 0; i < TmwAthena::EQUIP_VECTOR_END; i++)
{
- for (int i = 0; i < TmwAthena::EQUIP_VECTOR_END; i++)
- {
- gcn::Rectangle tRect(mEquipBox[i].posX, mEquipBox[i].posY,
- BOX_WIDTH, BOX_HEIGHT);
+ gcn::Rectangle tRect(mEquipBox[i].posX, mEquipBox[i].posY,
+ BOX_WIDTH, BOX_HEIGHT);
- if (tRect.isPointInRect(x, y))
- return mEquipment->getEquipment(i);
- }
+ if (tRect.isPointInRect(x, y))
+ return mEquipment->getEquipment(i);
}
- return NULL;
+ return 0;
}
void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
@@ -129,17 +125,14 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
if (mouseEvent.getButton() == gcn::MouseEvent::LEFT)
{
// Checks if any of the presses were in the equip boxes.
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ for (int i = 0; i < TmwAthena::EQUIP_VECTOR_END; i++)
{
- for (int i = 0; i < TmwAthena::EQUIP_VECTOR_END; i++)
- {
- Item *item = mEquipment->getEquipment(i);
- gcn::Rectangle tRect(mEquipBox[i].posX, mEquipBox[i].posY,
- BOX_WIDTH, BOX_HEIGHT);
+ Item *item = mEquipment->getEquipment(i);
+ gcn::Rectangle tRect(mEquipBox[i].posX, mEquipBox[i].posY,
+ BOX_WIDTH, BOX_HEIGHT);
- if (tRect.isPointInRect(x, y) && item)
- setSelected(i);
- }
+ if (tRect.isPointInRect(x, y) && item)
+ setSelected(i);
}
}
else if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT)