summaryrefslogtreecommitdiff
path: root/src/gui/buy.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-26 22:09:04 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-26 22:09:04 +0000
commit40339bebb026cd553aacbbff6f2fe1aa14816d5a (patch)
treef6398430043accbc90170ac15c62c8deebd895eb /src/gui/buy.cpp
parentfd279ae77295a6babedd31202078862eabcada9f (diff)
downloadMana-40339bebb026cd553aacbbff6f2fe1aa14816d5a.tar.gz
Mana-40339bebb026cd553aacbbff6f2fe1aa14816d5a.tar.bz2
Mana-40339bebb026cd553aacbbff6f2fe1aa14816d5a.tar.xz
Mana-40339bebb026cd553aacbbff6f2fe1aa14816d5a.zip
Got rid of the default MessageOut constructor, since all messages should have
an ID.
Diffstat (limited to 'src/gui/buy.cpp')
-rw-r--r--src/gui/buy.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 63a6e20e..165fa7dc 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -215,9 +215,9 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget)
// of items to be bought ever fails, Bertram removed the assertions, is
// there a better way to ensure this fails in an _obivous_ way in C++?
else if (eventId == "buy" && (mAmountItems > 0 &&
- mAmountItems <= mMaxItems)) {
- MessageOut outMsg;
- outMsg.writeShort(CMSG_NPC_BUY_REQUEST);
+ mAmountItems <= mMaxItems))
+ {
+ MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
outMsg.writeShort(8);
outMsg.writeShort(mAmountItems);
outMsg.writeShort(mShopItems->at(selectedItem).id);
@@ -262,9 +262,12 @@ void BuyDialog::mouseClick(int x, int y, int button, int count)
int selectedItem = mItemList->getSelected();
if (selectedItem > -1)
{
+ int itemId = mShopItems->at(selectedItem).id;
+ ItemInfo *itemInfo = itemDb->getItemInfo(itemId);
+
mItemDescLabel->setCaption("Description: " +
- itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getDescription());
+ itemInfo->getDescription());
mItemEffectLabel->setCaption("Effect: " +
- itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getEffect());
+ itemInfo->getEffect());
}
}