summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp203
-rw-r--r--src/gui/buy.h28
-rw-r--r--src/gui/char_select.cpp254
-rw-r--r--src/gui/char_select.h46
-rw-r--r--src/gui/char_server.cpp52
-rw-r--r--src/gui/char_server.h8
-rw-r--r--src/gui/chargedialog.cpp12
-rw-r--r--src/gui/chargedialog.h2
-rw-r--r--src/gui/chat.cpp98
-rw-r--r--src/gui/chat.h14
-rw-r--r--src/gui/debugwindow.cpp40
-rw-r--r--src/gui/debugwindow.h4
-rw-r--r--src/gui/equipmentwindow.cpp10
-rw-r--r--src/gui/equipmentwindow.h2
-rw-r--r--src/gui/focushandler.cpp10
-rw-r--r--src/gui/focushandler.h2
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/help.cpp18
-rw-r--r--src/gui/help.h4
-rw-r--r--src/gui/inttextbox.cpp16
-rw-r--r--src/gui/inttextbox.h6
-rw-r--r--src/gui/inventorywindow.cpp109
-rw-r--r--src/gui/inventorywindow.h16
-rw-r--r--src/gui/itemcontainer.cpp52
-rw-r--r--src/gui/itemcontainer.h8
-rw-r--r--src/gui/login.cpp124
-rw-r--r--src/gui/login.h21
-rw-r--r--src/gui/minimap.cpp4
-rw-r--r--src/gui/ministatus.cpp70
-rw-r--r--src/gui/ministatus.h4
-rw-r--r--src/gui/newskill.cpp80
-rw-r--r--src/gui/newskill.h10
-rw-r--r--src/gui/npclistdialog.cpp8
-rw-r--r--src/gui/npclistdialog.h2
-rw-r--r--src/gui/playerbox.cpp18
-rw-r--r--src/gui/playerbox.h6
-rw-r--r--src/gui/popupmenu.cpp54
-rw-r--r--src/gui/popupmenu.h2
-rw-r--r--src/gui/register.cpp150
-rw-r--r--src/gui/register.h25
-rw-r--r--src/gui/sell.cpp190
-rw-r--r--src/gui/sell.h24
-rw-r--r--src/gui/setup.cpp257
-rw-r--r--src/gui/setup.h69
-rw-r--r--src/gui/skill.cpp83
-rw-r--r--src/gui/skill.h15
-rw-r--r--src/gui/status.cpp390
-rw-r--r--src/gui/status.h38
-rw-r--r--src/gui/trade.cpp214
-rw-r--r--src/gui/trade.h28
-rw-r--r--src/gui/window.cpp46
-rw-r--r--src/gui/window.h12
52 files changed, 1454 insertions, 1508 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 42c6ff2f..18542385 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -44,65 +44,65 @@
BuyDialog::BuyDialog(Network *network):
Window("Buy"), mNetwork(network),
- m_money(0), m_amountItems(0), m_maxItems(0)
+ mMoney(0), mAmountItems(0), mMaxItems(0)
{
mShopItems = new ShopItems;
- itemList = new ListBox(mShopItems);
- scrollArea = new ScrollArea(itemList);
- slider = new Slider(1.0);
- quantityLabel = new gcn::Label("0");
- moneyLabel = new gcn::Label("Price: 0 GP");
- increaseButton = new Button("+", "+", this);
- decreaseButton = new Button("-", "-", this);
- buyButton = new Button("Buy", "buy", this);
- quitButton = new Button("Quit", "quit", this);
- itemDescLabel = new gcn::Label("Description:");
- itemEffectLabel = new gcn::Label("Effect:");
+ mItemList = new ListBox(mShopItems);
+ mScrollArea = new ScrollArea(mItemList);
+ mSlider = new Slider(1.0);
+ mQuantityLabel = new gcn::Label("0");
+ mMoneyLabel = new gcn::Label("Price: 0 GP");
+ mIncreaseButton = new Button("+", "+", this);
+ mDecreaseButton = new Button("-", "-", this);
+ mBuyButton = new Button("Buy", "buy", this);
+ mQuitButton = new Button("Quit", "quit", this);
+ mItemDescLabel = new gcn::Label("Description:");
+ mItemEffectLabel = new gcn::Label("Effect:");
setContentSize(260, 210);
- scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
- itemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
+ mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mScrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
+ mItemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
- slider->setDimension(gcn::Rectangle(5, 120, 200, 10));
- slider->setEnabled(false);
+ mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10));
+ mSlider->setEnabled(false);
- quantityLabel->setPosition(215, 120);
- moneyLabel->setPosition(5, 130);
+ mQuantityLabel->setPosition(215, 120);
+ mMoneyLabel->setPosition(5, 130);
- increaseButton->setPosition(40, 186);
- increaseButton->setSize(20, 20);
- increaseButton->setEnabled(false);
+ mIncreaseButton->setPosition(40, 186);
+ mIncreaseButton->setSize(20, 20);
+ mIncreaseButton->setEnabled(false);
- decreaseButton->setPosition(10, 186);
- decreaseButton->setSize(20, 20);
- decreaseButton->setEnabled(false);
+ mDecreaseButton->setPosition(10, 186);
+ mDecreaseButton->setSize(20, 20);
+ mDecreaseButton->setEnabled(false);
- buyButton->setPosition(180, 186);
- buyButton->setEnabled(false);
+ mBuyButton->setPosition(180, 186);
+ mBuyButton->setEnabled(false);
- quitButton->setPosition(212, 186);
+ mQuitButton->setPosition(212, 186);
- itemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14));
- itemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14));
+ mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14));
+ mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14));
- itemList->setEventId("item");
- slider->setEventId("slider");
+ mItemList->setEventId("item");
+ mSlider->setEventId("slider");
- itemList->addActionListener(this);
- slider->addActionListener(this);
+ mItemList->addActionListener(this);
+ mSlider->addActionListener(this);
- add(scrollArea);
- add(slider);
- add(quantityLabel);
- add(buyButton);
- add(quitButton);
- add(increaseButton);
- add(decreaseButton);
- add(moneyLabel);
- add(itemDescLabel);
- add(itemEffectLabel);
+ add(mScrollArea);
+ add(mSlider);
+ add(mQuantityLabel);
+ add(mBuyButton);
+ add(mQuitButton);
+ add(mIncreaseButton);
+ add(mDecreaseButton);
+ add(mMoneyLabel);
+ add(mItemDescLabel);
+ add(mItemEffectLabel);
setLocationRelativeTo(getParent());
}
@@ -114,27 +114,26 @@ BuyDialog::~BuyDialog()
void BuyDialog::setMoney(int amount)
{
- m_money = amount;
+ mMoney = amount;
}
void BuyDialog::reset()
{
mShopItems->clear();
- m_money = 0;
- slider->setValue(0.0);
- m_amountItems = 0;
+ mMoney = 0;
+ mSlider->setValue(0.0);
+ mAmountItems = 0;
// Reset Previous Selected Items to prevent failing asserts
- itemList->setSelected(-1);
- increaseButton->setEnabled(false);
- decreaseButton->setEnabled(false);
- quantityLabel->setCaption("0");
- quantityLabel->adjustSize();
- moneyLabel->setCaption("Price: 0");
- moneyLabel->adjustSize();
- itemDescLabel->setCaption("");
- itemEffectLabel->setCaption("");
-
+ mItemList->setSelected(-1);
+ mIncreaseButton->setEnabled(false);
+ mDecreaseButton->setEnabled(false);
+ mQuantityLabel->setCaption("0");
+ mQuantityLabel->adjustSize();
+ mMoneyLabel->setCaption("Price: 0");
+ mMoneyLabel->adjustSize();
+ mItemDescLabel->setCaption("");
+ mItemEffectLabel->setCaption("");
}
void BuyDialog::addItem(short id, int price)
@@ -148,35 +147,35 @@ void BuyDialog::addItem(short id, int price)
item_shop.id = id;
mShopItems->push_back(item_shop);
- itemList->adjustSize();
+ mItemList->adjustSize();
}
void BuyDialog::action(const std::string& eventId)
{
- int selectedItem = itemList->getSelected();
+ int selectedItem = mItemList->getSelected();
if (eventId == "item") {
// Reset amount of items and update labels
- m_amountItems = 0;
- slider->setValue(0);
- quantityLabel->setCaption("0");
- quantityLabel->adjustSize();
- moneyLabel->setCaption("Price : 0 GP");
- moneyLabel->adjustSize();
+ mAmountItems = 0;
+ mSlider->setValue(0);
+ mQuantityLabel->setCaption("0");
+ mQuantityLabel->adjustSize();
+ mMoneyLabel->setCaption("Price : 0 GP");
+ mMoneyLabel->adjustSize();
// Disable buttons for buying and decreasing
- buyButton->setEnabled(false);
- decreaseButton->setEnabled(false);
+ mBuyButton->setEnabled(false);
+ mDecreaseButton->setEnabled(false);
// If no item was selected, none can be bought, otherwise
// calculate how many the player can afford
- m_maxItems = (itemList->getSelected() == -1) ? 0 :
- m_money / mShopItems->at(selectedItem).price;
+ mMaxItems = (mItemList->getSelected() == -1) ? 0 :
+ mMoney / mShopItems->at(selectedItem).price;
// When at least one item can be bought, enable the slider and the
// increase button
- increaseButton->setEnabled(m_maxItems > 0);
- slider->setEnabled(m_maxItems > 0);
+ mIncreaseButton->setEnabled(mMaxItems > 0);
+ mSlider->setEnabled(mMaxItems > 0);
}
else if (eventId == "quit") {
setVisible(false);
@@ -191,52 +190,52 @@ void BuyDialog::action(const std::string& eventId)
bool updateButtonsAndLabels = false;
if (eventId == "slider") {
- m_amountItems = (int)(slider->getValue() * m_maxItems);
+ mAmountItems = (int)(mSlider->getValue() * mMaxItems);
updateButtonsAndLabels = true;
}
else if (eventId == "+") {
- if (m_amountItems < m_maxItems) {
- m_amountItems++;
+ if (mAmountItems < mMaxItems) {
+ mAmountItems++;
} else {
- m_amountItems = m_maxItems;
+ mAmountItems = mMaxItems;
}
- slider->setValue(double(m_amountItems)/double(m_maxItems));
+ mSlider->setValue(double(mAmountItems)/double(mMaxItems));
updateButtonsAndLabels = true;
}
else if (eventId == "-") {
- if (m_amountItems > 0) {
- m_amountItems--;
+ if (mAmountItems > 0) {
+ mAmountItems--;
} else {
- m_amountItems = 0;
+ mAmountItems = 0;
}
- slider->setValue(double(m_amountItems)/double(m_maxItems));
+ mSlider->setValue(double(mAmountItems)/double(mMaxItems));
updateButtonsAndLabels = true;
}
// TODO Actually we'd have a bug elsewhere if this check for the number
// 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" && (m_amountItems > 0 &&
- m_amountItems <= m_maxItems)) {
+ else if (eventId == "buy" && (mAmountItems > 0 &&
+ mAmountItems <= mMaxItems)) {
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_BUY_REQUEST);
outMsg.writeInt16(8);
- outMsg.writeInt16(m_amountItems);
+ outMsg.writeInt16(mAmountItems);
outMsg.writeInt16(mShopItems->at(selectedItem).id);
// update money !
- m_money -= m_amountItems * mShopItems->at(selectedItem).price;
+ mMoney -= mAmountItems * mShopItems->at(selectedItem).price;
// Update number of items that can be bought at max
- m_maxItems -= m_amountItems;
+ mMaxItems -= mAmountItems;
- if (!m_maxItems) {
- slider->setEnabled(false);
+ if (!mMaxItems) {
+ mSlider->setEnabled(false);
}
// Reset selection
- m_amountItems = 0;
- slider->setValue(0);
+ mAmountItems = 0;
+ mSlider->setValue(0);
updateButtonsAndLabels = true;
}
@@ -246,19 +245,19 @@ void BuyDialog::action(const std::string& eventId)
std::stringstream oss;
// Update buttons
- increaseButton->setEnabled(m_amountItems < m_maxItems);
- decreaseButton->setEnabled(m_amountItems > 0);
- buyButton->setEnabled(m_amountItems > 0);
+ mIncreaseButton->setEnabled(mAmountItems < mMaxItems);
+ mDecreaseButton->setEnabled(mAmountItems > 0);
+ mBuyButton->setEnabled(mAmountItems > 0);
// Update labels
- oss << m_amountItems;
- quantityLabel->setCaption(oss.str());
- quantityLabel->adjustSize();
+ oss << mAmountItems;
+ mQuantityLabel->setCaption(oss.str());
+ mQuantityLabel->adjustSize();
oss.str("");
- oss << "Price : " << m_amountItems * mShopItems->at(selectedItem).price << " GP";
- moneyLabel->setCaption(oss.str());
- moneyLabel->adjustSize();
+ oss << "Price : " << mAmountItems * mShopItems->at(selectedItem).price << " GP";
+ mMoneyLabel->setCaption(oss.str());
+ mMoneyLabel->adjustSize();
}
}
@@ -266,12 +265,12 @@ void BuyDialog::mouseClick(int x, int y, int button, int count)
{
Window::mouseClick(x, y, button, count);
- int selectedItem = itemList->getSelected();
+ int selectedItem = mItemList->getSelected();
if (selectedItem > -1)
{
- itemDescLabel->setCaption("Description: " +
+ mItemDescLabel->setCaption("Description: " +
itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getDescription());
- itemEffectLabel->setCaption("Effect: " +
+ mItemEffectLabel->setCaption("Effect: " +
itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getEffect());
}
}
diff --git a/src/gui/buy.h b/src/gui/buy.h
index bf84d24e..0349be4a 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -90,23 +90,23 @@ class BuyDialog : public Window, public gcn::ActionListener
private:
Network *mNetwork;
- gcn::Button *buyButton;
- gcn::Button *quitButton;
- gcn::Button *increaseButton;
- gcn::Button *decreaseButton;
- gcn::ListBox *itemList;
- gcn::ScrollArea *scrollArea;
- gcn::Label *itemDescLabel;
- gcn::Label *itemEffectLabel;
- gcn::Label *moneyLabel;
- gcn::Label *quantityLabel;
- gcn::Slider *slider;
+ gcn::Button *mBuyButton;
+ gcn::Button *mQuitButton;
+ gcn::Button *mIncreaseButton;
+ gcn::Button *mDecreaseButton;
+ gcn::ListBox *mItemList;
+ gcn::ScrollArea *mScrollArea;
+ gcn::Label *mItemDescLabel;
+ gcn::Label *mItemEffectLabel;
+ gcn::Label *mMoneyLabel;
+ gcn::Label *mQuantityLabel;
+ gcn::Slider *mSlider;
ShopItems *mShopItems;
- int m_money;
- int m_amountItems;
- int m_maxItems;
+ int mMoney;
+ int mAmountItems;
+ int mMaxItems;
};
#endif
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 72f0b554..b1d08951 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -71,53 +71,53 @@ void CharDeleteConfirm::action(const std::string &eventId)
CharSelectDialog::CharSelectDialog(Network *network, LockedArray<LocalPlayer*> *charInfo):
Window("Select Character"), mNetwork(network), mCharInfo(charInfo), mCharSelected(false)
{
- selectButton = new Button("Ok", "ok", this);
- cancelButton = new Button("Cancel", "cancel", this);
- newCharButton = new Button("New", "new", this);
- delCharButton = new Button("Delete", "delete", this);
- previousButton = new Button("Previous", "previous", this);
- nextButton = new Button("Next", "next", this);
-
- nameLabel = new gcn::Label("Name");
- levelLabel = new gcn::Label("Level");
- jobLevelLabel = new gcn::Label("Job Level");
- moneyLabel = new gcn::Label("Money");
- playerBox = new PlayerBox();
+ mSelectButton = new Button("Ok", "ok", this);
+ mCancelButton = new Button("Cancel", "cancel", this);
+ mNewCharButton = new Button("New", "new", this);
+ mDelCharButton = new Button("Delete", "delete", this);
+ mPreviousButton = new Button("Previous", "previous", this);
+ mNextButton = new Button("Next", "next", this);
+
+ mNameLabel = new gcn::Label("Name");
+ mLevelLabel = new gcn::Label("Level");
+ mJobLevelLabel = new gcn::Label("Job Level");
+ mMoneyLabel = new gcn::Label("Money");
+ mPlayerBox = new PlayerBox();
int w = 195;
int h = 220;
setContentSize(w, h);
- playerBox->setDimension(gcn::Rectangle(5, 5, w - 10, 90));
- nameLabel->setDimension(gcn::Rectangle(10, 100, 128, 16));
- levelLabel->setDimension(gcn::Rectangle(10, 116, 128, 16));
- jobLevelLabel->setDimension(gcn::Rectangle(10, 132, 128, 16));
- moneyLabel->setDimension(gcn::Rectangle(10, 148, 128, 16));
- previousButton->setPosition(5, 170);
- nextButton->setPosition(previousButton->getWidth() + 10, 170);
- newCharButton->setPosition(5, h - 5 - newCharButton->getHeight());
- delCharButton->setPosition(
- 5 + newCharButton->getWidth() + 5,
- newCharButton->getY());
- cancelButton->setPosition(
- w - 5 - cancelButton->getWidth(),
- newCharButton->getY());
- selectButton->setPosition(
- cancelButton->getX() - 5 - selectButton->getWidth(),
- newCharButton->getY());
-
- add(playerBox);
- add(selectButton);
- add(cancelButton);
- add(newCharButton);
- add(delCharButton);
- add(previousButton);
- add(nextButton);
- add(nameLabel);
- add(levelLabel);
- add(jobLevelLabel);
- add(moneyLabel);
-
- selectButton->requestFocus();
+ mPlayerBox->setDimension(gcn::Rectangle(5, 5, w - 10, 90));
+ mNameLabel->setDimension(gcn::Rectangle(10, 100, 128, 16));
+ mLevelLabel->setDimension(gcn::Rectangle(10, 116, 128, 16));
+ mJobLevelLabel->setDimension(gcn::Rectangle(10, 132, 128, 16));
+ mMoneyLabel->setDimension(gcn::Rectangle(10, 148, 128, 16));
+ mPreviousButton->setPosition(5, 170);
+ mNextButton->setPosition(mPreviousButton->getWidth() + 10, 170);
+ mNewCharButton->setPosition(5, h - 5 - mNewCharButton->getHeight());
+ mDelCharButton->setPosition(
+ 5 + mNewCharButton->getWidth() + 5,
+ mNewCharButton->getY());
+ mCancelButton->setPosition(
+ w - 5 - mCancelButton->getWidth(),
+ mNewCharButton->getY());
+ mSelectButton->setPosition(
+ mCancelButton->getX() - 5 - mSelectButton->getWidth(),
+ mNewCharButton->getY());
+
+ add(mPlayerBox);
+ add(mSelectButton);
+ add(mCancelButton);
+ add(mNewCharButton);
+ add(mDelCharButton);
+ add(mPreviousButton);
+ add(mNextButton);
+ add(mNameLabel);
+ add(mLevelLabel);
+ add(mJobLevelLabel);
+ add(mMoneyLabel);
+
+ mSelectButton->requestFocus();
setLocationRelativeTo(getParent());
updatePlayerInfo();
}
@@ -127,11 +127,11 @@ void CharSelectDialog::action(const std::string& eventId)
if (eventId == "ok" && n_character > 0)
{
// Start game
- newCharButton->setEnabled(false);
- delCharButton->setEnabled(false);
- selectButton->setEnabled(false);
- previousButton->setEnabled(false);
- nextButton->setEnabled(false);
+ mNewCharButton->setEnabled(false);
+ mDelCharButton->setEnabled(false);
+ mSelectButton->setEnabled(false);
+ mPreviousButton->setEnabled(false);
+ mNextButton->setEnabled(false);
mCharSelected = true;
attemptCharSelect();
}
@@ -174,36 +174,36 @@ void CharSelectDialog::updatePlayerInfo()
std::stringstream nameCaption, levelCaption, jobCaption, moneyCaption;
nameCaption << pi->getName();
- levelCaption << "Lvl: " << pi->lvl;
- jobCaption << "Job Lvl: " << pi->jobLvl;
- moneyCaption << "Gold: " << pi->gp;
-
- nameLabel->setCaption(nameCaption.str());
- levelLabel->setCaption(levelCaption.str());
- jobLevelLabel->setCaption(jobCaption.str());
- moneyLabel->setCaption(moneyCaption.str());
+ levelCaption << "Lvl: " << pi->mLevel;
+ jobCaption << "Job Lvl: " << pi->mJobLevel;
+ moneyCaption << "Gold: " << pi->mGp;
+
+ mNameLabel->setCaption(nameCaption.str());
+ mLevelLabel->setCaption(levelCaption.str());
+ mJobLevelLabel->setCaption(jobCaption.str());
+ mMoneyLabel->setCaption(moneyCaption.str());
if (!mCharSelected)
{
- newCharButton->setEnabled(false);
- delCharButton->setEnabled(true);
- selectButton->setEnabled(true);
+ mNewCharButton->setEnabled(false);
+ mDelCharButton->setEnabled(true);
+ mSelectButton->setEnabled(true);
}
- playerBox->hairStyle = pi->getHairStyle() - 1;
- playerBox->hairColor = pi->getHairColor() - 1;
- playerBox->showPlayer = true;
+ mPlayerBox->mHairStyle = pi->getHairStyle() - 1;
+ mPlayerBox->mHairColor = pi->getHairColor() - 1;
+ mPlayerBox->mShowPlayer = true;
}
else {
- nameLabel->setCaption("Name");
- levelLabel->setCaption("Level");
- jobLevelLabel->setCaption("Job Level");
- moneyLabel->setCaption("Money");
- newCharButton->setEnabled(true);
- delCharButton->setEnabled(false);
- selectButton->setEnabled(false);
-
- playerBox->hairStyle = 0;
- playerBox->hairColor = 0;
- playerBox->showPlayer = false;
+ mNameLabel->setCaption("Name");
+ mLevelLabel->setCaption("Level");
+ mJobLevelLabel->setCaption("Job Level");
+ mMoneyLabel->setCaption("Money");
+ mNewCharButton->setEnabled(true);
+ mDelCharButton->setEnabled(false);
+ mSelectButton->setEnabled(false);
+
+ mPlayerBox->mHairStyle = 0;
+ mPlayerBox->mHairColor = 0;
+ mPlayerBox->mShowPlayer = false;
}
}
@@ -234,54 +234,54 @@ void CharSelectDialog::logic()
CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network):
Window("Create Character", true, parent), mNetwork(network), mSlot(slot)
{
- nameField = new TextField("");
- nameLabel = new gcn::Label("Name:");
- nextHairColorButton = new Button(">", "nextcolor", this);
- prevHairColorButton = new Button("<", "prevcolor", this);
- hairColorLabel = new gcn::Label("Hair Color:");
- nextHairStyleButton = new Button(">", "nextstyle", this);
- prevHairStyleButton = new Button("<", "prevstyle", this);
- hairStyleLabel = new gcn::Label("Hair Style:");
- createButton = new Button("Create", "create", this);
- cancelButton = new Button("Cancel", "cancel", this);
- playerBox = new PlayerBox();
- playerBox->showPlayer = true;
-
- nameField->setEventId("create");
+ mNameField = new TextField("");
+ mNameLabel = new gcn::Label("Name:");
+ mNextHairColorButton = new Button(">", "nextcolor", this);
+ mPrevHairColorButton = new Button("<", "prevcolor", this);
+ mHairColorLabel = new gcn::Label("Hair Color:");
+ mNextHairStyleButton = new Button(">", "nextstyle", this);
+ mPrevHairStyleButton = new Button("<", "prevstyle", this);
+ mHairStyleLabel = new gcn::Label("Hair Style:");
+ mCreateButton = new Button("Create", "create", this);
+ mCancelButton = new Button("Cancel", "cancel", this);
+ mPlayerBox = new PlayerBox();
+ mPlayerBox->mShowPlayer = true;
+
+ mNameField->setEventId("create");
int w = 200;
int h = 150;
setContentSize(w, h);
- playerBox->setDimension(gcn::Rectangle(80, 30, 110, 85));
- nameLabel->setPosition(5, 5);
- nameField->setDimension(
- gcn::Rectangle(45, 5, w - 45 - 7, nameField->getHeight()));
- prevHairColorButton->setPosition(90, 35);
- nextHairColorButton->setPosition(165, 35);
- hairColorLabel->setPosition(5, 40);
- prevHairStyleButton->setPosition(90, 64);
- nextHairStyleButton->setPosition(165, 64);
- hairStyleLabel->setPosition(5, 70);
- cancelButton->setPosition(
- w - 5 - cancelButton->getWidth(),
- h - 5 - cancelButton->getHeight());
- createButton->setPosition(
- cancelButton->getX() - 5 - createButton->getWidth(),
- h - 5 - cancelButton->getHeight());
-
- nameField->addActionListener(this);
-
- add(playerBox);
- add(nameField);
- add(nameLabel);
- add(nextHairColorButton);
- add(prevHairColorButton);
- add(hairColorLabel);
- add(nextHairStyleButton);
- add(prevHairStyleButton);
- add(hairStyleLabel);
- add(createButton);
- add(cancelButton);
+ mPlayerBox->setDimension(gcn::Rectangle(80, 30, 110, 85));
+ mNameLabel->setPosition(5, 5);
+ mNameField->setDimension(
+ gcn::Rectangle(45, 5, w - 45 - 7, mNameField->getHeight()));
+ mPrevHairColorButton->setPosition(90, 35);
+ mNextHairColorButton->setPosition(165, 35);
+ mHairColorLabel->setPosition(5, 40);
+ mPrevHairStyleButton->setPosition(90, 64);
+ mNextHairStyleButton->setPosition(165, 64);
+ mHairStyleLabel->setPosition(5, 70);
+ mCancelButton->setPosition(
+ w - 5 - mCancelButton->getWidth(),
+ h - 5 - mCancelButton->getHeight());
+ mCreateButton->setPosition(
+ mCancelButton->getX() - 5 - mCreateButton->getWidth(),
+ h - 5 - mCancelButton->getHeight());
+
+ mNameField->addActionListener(this);
+
+ add(mPlayerBox);
+ add(mNameField);
+ add(mNameLabel);
+ add(mNextHairColorButton);
+ add(mPrevHairColorButton);
+ add(mHairColorLabel);
+ add(mNextHairStyleButton);
+ add(mPrevHairStyleButton);
+ add(mHairStyleLabel);
+ add(mCreateButton);
+ add(mCancelButton);
setLocationRelativeTo(getParent());
}
@@ -291,7 +291,7 @@ void CharCreateDialog::action(const std::string& eventId)
if (eventId == "create") {
if (getName().length() >= 4) {
// Attempt to create the character
- createButton->setEnabled(false);
+ mCreateButton->setEnabled(false);
attemptCharCreate();
scheduleDelete();
}
@@ -304,25 +304,25 @@ void CharCreateDialog::action(const std::string& eventId)
scheduleDelete();
}
else if (eventId == "nextcolor") {
- playerBox->hairColor++;
+ mPlayerBox->mHairColor++;
}
else if (eventId == "prevcolor") {
- playerBox->hairColor += NR_HAIR_COLORS - 1;
+ mPlayerBox->mHairColor += NR_HAIR_COLORS - 1;
}
else if (eventId == "nextstyle") {
- playerBox->hairStyle++;
+ mPlayerBox->mHairStyle++;
}
else if (eventId == "prevstyle") {
- playerBox->hairStyle += NR_HAIR_STYLES - 1;
+ mPlayerBox->mHairStyle += NR_HAIR_STYLES - 1;
}
- playerBox->hairColor %= NR_HAIR_COLORS;
- playerBox->hairStyle %= NR_HAIR_STYLES;
+ mPlayerBox->mHairColor %= NR_HAIR_COLORS;
+ mPlayerBox->mHairStyle %= NR_HAIR_STYLES;
}
std::string CharCreateDialog::getName()
{
- return nameField->getText();
+ return mNameField->getText();
}
void CharCreateDialog::attemptCharCreate()
@@ -338,6 +338,6 @@ void CharCreateDialog::attemptCharCreate()
outMsg.writeInt8(5);
outMsg.writeInt8(5);
outMsg.writeInt8(mSlot);
- outMsg.writeInt16(playerBox->hairColor + 1);
- outMsg.writeInt16(playerBox->hairStyle + 1);
+ outMsg.writeInt16(mPlayerBox->mHairColor + 1);
+ outMsg.writeInt16(mPlayerBox->mHairStyle + 1);
}
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 0cfc4f94..4531592e 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -57,19 +57,19 @@ class CharSelectDialog : public Window, public gcn::ActionListener
Network *mNetwork;
LockedArray<LocalPlayer*> *mCharInfo;
- gcn::Button *selectButton;
- gcn::Button *cancelButton;
- gcn::Button *newCharButton;
- gcn::Button *delCharButton;
- gcn::Button *previousButton;
- gcn::Button *nextButton;
+ gcn::Button *mSelectButton;
+ gcn::Button *mCancelButton;
+ gcn::Button *mNewCharButton;
+ gcn::Button *mDelCharButton;
+ gcn::Button *mPreviousButton;
+ gcn::Button *mNextButton;
- gcn::Label *nameLabel;
- gcn::Label *levelLabel;
- gcn::Label *jobLevelLabel;
- gcn::Label *moneyLabel;
+ gcn::Label *mNameLabel;
+ gcn::Label *mLevelLabel;
+ gcn::Label *mJobLevelLabel;
+ gcn::Label *mMoneyLabel;
- PlayerBox *playerBox;
+ PlayerBox *mPlayerBox;
bool mCharSelected;
@@ -103,18 +103,18 @@ class CharCreateDialog : public Window, public gcn::ActionListener
private:
Network *mNetwork;
- gcn::TextField *nameField;
- gcn::Label *nameLabel;
- gcn::Button *nextHairColorButton;
- gcn::Button *prevHairColorButton;
- gcn::Label *hairColorLabel;
- gcn::Button *nextHairStyleButton;
- gcn::Button *prevHairStyleButton;
- gcn::Label *hairStyleLabel;
- gcn::Button *createButton;
- gcn::Button *cancelButton;
-
- PlayerBox *playerBox;
+ gcn::TextField *mNameField;
+ gcn::Label *mNameLabel;
+ gcn::Button *mNextHairColorButton;
+ gcn::Button *mPrevHairColorButton;
+ gcn::Label *mHairColorLabel;
+ gcn::Button *mNextHairStyleButton;
+ gcn::Button *mPrevHairStyleButton;
+ gcn::Label *mHairStyleLabel;
+ gcn::Button *mCreateButton;
+ gcn::Button *mCancelButton;
+
+ PlayerBox *mPlayerBox;
int mSlot;
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 37ef0462..8a0a67ab 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -51,57 +51,57 @@ class ServerListModel : public gcn::ListModel {
ServerSelectDialog::ServerSelectDialog(LoginData *loginData):
Window("Select Server"), mLoginData(loginData)
{
- serverListModel = new ServerListModel();
- serverList = new ListBox(serverListModel);
- scrollArea = new ScrollArea(serverList);
- okButton = new Button("OK", "ok", this);
- cancelButton = new Button("Cancel", "cancel", this);
+ mServerListModel = new ServerListModel();
+ mServerList = new ListBox(mServerListModel);
+ ScrollArea *mScrollArea = new ScrollArea(mServerList);
+ mOkButton = new Button("OK", "ok", this);
+ Button *mCancelButton = new Button("Cancel", "cancel", this);
setContentSize(200, 100);
- cancelButton->setPosition(
- 200 - cancelButton->getWidth() - 5,
- 100 - cancelButton->getHeight() - 5);
- okButton->setPosition(
- cancelButton->getX() - okButton->getWidth() - 5,
- 100 - okButton->getHeight() - 5);
- scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- scrollArea->setDimension(gcn::Rectangle(
+ mCancelButton->setPosition(
+ 200 - mCancelButton->getWidth() - 5,
+ 100 - mCancelButton->getHeight() - 5);
+ mOkButton->setPosition(
+ mCancelButton->getX() - mOkButton->getWidth() - 5,
+ 100 - mOkButton->getHeight() - 5);
+ mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mScrollArea->setDimension(gcn::Rectangle(
5, 5, 200 - 2 * 5,
- 100 - 3 * 5 - cancelButton->getHeight() -
- scrollArea->getBorderSize()));
+ 100 - 3 * 5 - mCancelButton->getHeight() -
+ mScrollArea->getBorderSize()));
- serverList->setEventId("ok");
+ mServerList->setEventId("ok");
- //serverList->addActionListener(this);
+ //mServerList->addActionListener(this);
- add(scrollArea);
- add(okButton);
- add(cancelButton);
+ add(mScrollArea);
+ add(mOkButton);
+ add(mCancelButton);
if (n_server == 0) {
// Disable Ok button
- okButton->setEnabled(false);
+ mOkButton->setEnabled(false);
} else {
// Select first server
- serverList->setSelected(1);
+ mServerList->setSelected(1);
}
- okButton->requestFocus();
+ mOkButton->requestFocus();
setLocationRelativeTo(getParent());
}
ServerSelectDialog::~ServerSelectDialog()
{
- delete serverListModel;
+ delete mServerListModel;
}
void
ServerSelectDialog::action(const std::string& eventId)
{
if (eventId == "ok") {
- okButton->setEnabled(false);
- const SERVER_INFO *si = server_info[serverList->getSelected()];
+ mOkButton->setEnabled(false);
+ const SERVER_INFO *si = server_info[mServerList->getSelected()];
mLoginData->hostname = iptostring(si->address);
mLoginData->port = si->port;
state = CHAR_CONNECT_STATE;
diff --git a/src/gui/char_server.h b/src/gui/char_server.h
index b4112d75..85ae2408 100644
--- a/src/gui/char_server.h
+++ b/src/gui/char_server.h
@@ -60,11 +60,9 @@ class ServerSelectDialog : public Window, public gcn::ActionListener {
private:
LoginData *mLoginData;
- ServerListModel *serverListModel;
- gcn::ListBox *serverList;
- gcn::Button *okButton;
- gcn::Button *cancelButton;
- gcn::ScrollArea *scrollArea;
+ ServerListModel *mServerListModel;
+ gcn::ListBox *mServerList;
+ gcn::Button *mOkButton;
};
#endif
diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp
index da02cada..9b300950 100644
--- a/src/gui/chargedialog.cpp
+++ b/src/gui/chargedialog.cpp
@@ -34,23 +34,23 @@ ChargeDialog::ChargeDialog():
Window("")
{
setContentSize(180, 70);
- progBar = new ProgressBar(0.0f, 20, 40, 140, 25, 128, 128, 128);
- add(progBar);
+ mProgBar = new ProgressBar(0.0f, 20, 40, 140, 25, 128, 128, 128);
+ add(mProgBar);
}
// update the dialog
void ChargeDialog::logic()
{
// calculate time since the last attack was made
- player_node->lastAttackTime += .01; // this a hack until someone explains
+ player_node->mLastAttackTime += .01; // this a hack until someone explains
// to me how to work the timer
- if (player_node->lastAttackTime > 1)
+ if (player_node->mLastAttackTime > 1)
{
- player_node->lastAttackTime = 1;
+ player_node->mLastAttackTime = 1;
}
// reset the progress bar to display accurate time since attack
- progBar->setProgress(player_node->lastAttackTime);
+ mProgBar->setProgress(player_node->mLastAttackTime);
Window::logic();
}
diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h
index 22dc5d23..d1726500 100644
--- a/src/gui/chargedialog.h
+++ b/src/gui/chargedialog.h
@@ -43,7 +43,7 @@ class ChargeDialog : public Window
void logic();
private:
- ProgressBar* progBar;
+ ProgressBar* mProgBar;
};
#endif
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 28259c77..558c5558 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -48,66 +48,66 @@ ChatWindow::ChatWindow(const std::string &logfile, Network *network):
mTmpVisible(false)
{
setWindowName("Chat");
- chatlog_file.open(logfile.c_str(), std::ios::out | std::ios::app);
- items = 0;
- items_keep = 20;
+ mChatlogFile.open(logfile.c_str(), std::ios::out | std::ios::app);
+ mItems = 0;
+ mItemsKeep = 20;
setResizable(true);
setDefaultSize(0, (graphics->getHeight() - 123), 600, 100);
loadWindowState();
- chatInput = new ChatInput();
- chatInput->setEventId("chatinput");
- chatInput->addActionListener(this);
-
- textOutput = new BrowserBox(BrowserBox::AUTO_WRAP);
- textOutput->setOpaque(false);
- textOutput->disableLinksAndUserColors();
- scrollArea = new ScrollArea(textOutput);
- scrollArea->setPosition(
- scrollArea->getBorderSize(), scrollArea->getBorderSize());
- scrollArea->setScrollPolicy(
+ mChatInput = new ChatInput();
+ mChatInput->setEventId("chatinput");
+ mChatInput->addActionListener(this);
+
+ mTextOutput = new BrowserBox(BrowserBox::AUTO_WRAP);
+ mTextOutput->setOpaque(false);
+ mTextOutput->disableLinksAndUserColors();
+ mScrollArea = new ScrollArea(mTextOutput);
+ mScrollArea->setPosition(
+ mScrollArea->getBorderSize(), mScrollArea->getBorderSize());
+ mScrollArea->setScrollPolicy(
gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS);
- scrollArea->setOpaque(false);
+ mScrollArea->setOpaque(false);
- add(scrollArea);
- add(chatInput);
+ add(mScrollArea);
+ add(mChatInput);
// Add key listener to chat input to be able to respond to up/down
- chatInput->addKeyListener(this);
+ mChatInput->addKeyListener(this);
mCurHist = mHistory.end();
}
ChatWindow::~ChatWindow()
{
- chatlog_file.flush();
- chatlog_file.close();
+ mChatlogFile.flush();
+ mChatlogFile.close();
}
void
ChatWindow::logic()
{
- chatInput->setPosition(
- chatInput->getBorderSize(),
- getContent()->getHeight() - chatInput->getHeight() -
- chatInput->getBorderSize());
- chatInput->setWidth(
- getContent()->getWidth() - 2 * chatInput->getBorderSize());
-
- scrollArea->setWidth(
- getContent()->getWidth() - 2 * scrollArea->getBorderSize());
- scrollArea->setHeight(
- getContent()->getHeight() - 2 * scrollArea->getBorderSize() -
- chatInput->getHeight() - 5);
- scrollArea->logic();
+ mChatInput->setPosition(
+ mChatInput->getBorderSize(),
+ getContent()->getHeight() - mChatInput->getHeight() -
+ mChatInput->getBorderSize());
+ mChatInput->setWidth(
+ getContent()->getWidth() - 2 * mChatInput->getBorderSize());
+
+ mScrollArea->setWidth(
+ getContent()->getWidth() - 2 * mScrollArea->getBorderSize());
+ mScrollArea->setHeight(
+ getContent()->getHeight() - 2 * mScrollArea->getBorderSize() -
+ mChatInput->getHeight() - 5);
+ mScrollArea->logic();
}
void
ChatWindow::chatLog(std::string line, int own)
{
// Delete overhead from the end of the list
- while ((int)chatlog.size() > items_keep) {
- chatlog.pop_back();
+ while ((int)mChatlog.size() > mItemsKeep) {
+ mChatlog.pop_back();
}
CHATLOG tmp;
@@ -173,14 +173,14 @@ ChatWindow::chatLog(std::string line, int own)
// We look if the Vertical Scroll Bar is set at the max before
// adding a row, otherwise the max will always be a row higher
// at comparison.
- if ( scrollArea->getVerticalScrollAmount() == scrollArea->getVerticalMaxScroll() )
+ if (mScrollArea->getVerticalScrollAmount() == mScrollArea->getVerticalMaxScroll() )
{
- textOutput->addRow(line);
- scrollArea->setVerticalScrollAmount(scrollArea->getVerticalMaxScroll());
+ mTextOutput->addRow(line);
+ mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
}
else
{
- textOutput->addRow(line);
+ mTextOutput->addRow(line);
}
}
@@ -195,7 +195,7 @@ ChatWindow::action(const std::string& eventId)
{
if (eventId == "chatinput")
{
- std::string message = chatInput->getText();
+ std::string message = mChatInput->getText();
if (message.length() > 0) {
// If message different from previous, put it in the history
@@ -210,7 +210,7 @@ ChatWindow::action(const std::string& eventId)
chatSend(player_node->getName().c_str(), message.c_str());
// Clear the text from the chat input
- chatInput->setText("");
+ mChatInput->setText("");
}
// Remove focus and hide input
@@ -241,14 +241,14 @@ ChatWindow::requestChatFocus()
}
// Give focus to the chat input
- chatInput->setVisible(true);
- chatInput->requestFocus();
+ mChatInput->setVisible(true);
+ mChatInput->requestFocus();
}
bool
ChatWindow::isFocused()
{
- return chatInput->hasFocus();
+ return mChatInput->hasFocus();
}
void
@@ -389,8 +389,8 @@ ChatWindow::keyPress(const gcn::Key &key)
// Move forward through the history
HistoryIterator prevHist = mCurHist++;
if (mCurHist != mHistory.end()) {
- chatInput->setText(*mCurHist);
- chatInput->setCaretPosition(chatInput->getText().length());
+ mChatInput->setText(*mCurHist);
+ mChatInput->setCaretPosition(mChatInput->getText().length());
}
else {
mCurHist = prevHist;
@@ -401,15 +401,15 @@ ChatWindow::keyPress(const gcn::Key &key)
{
// Move backward through the history
mCurHist--;
- chatInput->setText(*mCurHist);
- chatInput->setCaretPosition(chatInput->getText().length());
+ mChatInput->setText(*mCurHist);
+ mChatInput->setCaretPosition(mChatInput->getText().length());
}
}
void
ChatWindow::setInputText(std::string input_str)
{
- chatInput->setText(input_str + " ");
+ mChatInput->setText(input_str + " ");
requestChatFocus();
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index b460e4c0..f1c48569 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -195,7 +195,7 @@ class ChatWindow : public Window, public gcn::ActionListener,
private:
Network *mNetwork;
- std::ofstream chatlog_file;
+ std::ofstream mChatlogFile;
bool mTmpVisible;
/** One item in the chat log */
@@ -206,17 +206,17 @@ class ChatWindow : public Window, public gcn::ActionListener,
int own;
};
- std::list<CHATLOG> chatlog; /**< Chat log */
+ std::list<CHATLOG> mChatlog; /**< Chat log */
- int items;
- int items_keep;
+ int mItems;
+ int mItemsKeep;
/** Constructs failed messages for actions */
std::string const_msg(CHATSKILL);
- gcn::TextField *chatInput; /**< Input box for typing chat messages */
- BrowserBox *textOutput; /**< Text box for displaying chat history */
- ScrollArea *scrollArea; /**< Scroll area around text output */
+ gcn::TextField *mChatInput; /**< Input box for typing chat messages */
+ BrowserBox *mTextOutput; /**< Text box for displaying chat history */
+ ScrollArea *mScrollArea; /**< Scroll area around text output */
typedef std::list<std::string> History;
typedef History::iterator HistoryIterator;
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index a327eec3..cf30df93 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -42,25 +42,25 @@ DebugWindow::DebugWindow():
setDefaultSize(0, 0, 400, 100);
loadWindowState();
- FPSLabel = new gcn::Label("[0 FPS]");
- FPSLabel->setPosition(0,0);
+ mFPSLabel = new gcn::Label("[0 FPS]");
+ mFPSLabel->setPosition(0,0);
- musicFileLabel = new gcn::Label("Music File: ");
- musicFileLabel->setPosition(0, 20);
+ mMusicFileLabel = new gcn::Label("Music File: ");
+ mMusicFileLabel->setPosition(0, 20);
- mapFileLabel = new gcn::Label("Mini-Map File: ");
- mapFileLabel->setPosition(0, 40);
+ mMapFileLabel = new gcn::Label("Mini-Map File: ");
+ mMapFileLabel->setPosition(0, 40);
- tileMouseLabel = new gcn::Label("[Mouse: 0, 0]");
- tileMouseLabel->setPosition(100, 0);
+ mTileMouseLabel = new gcn::Label("[Mouse: 0, 0]");
+ mTileMouseLabel->setPosition(100, 0);
Button *closeButton = new Button("Close", "close", this);
closeButton->setPosition(5, 60);
- add(FPSLabel);
- add(musicFileLabel);
- add(mapFileLabel);
- add(tileMouseLabel);
+ add(mFPSLabel);
+ add(mMusicFileLabel);
+ add(mMapFileLabel);
+ add(mTileMouseLabel);
add(closeButton);
}
@@ -75,13 +75,13 @@ DebugWindow::logic()
std::stringstream updatedText;
updatedText << "[" << fps << " FPS]";
- FPSLabel->setCaption(updatedText.str());
- FPSLabel->adjustSize();
+ mFPSLabel->setCaption(updatedText.str());
+ mFPSLabel->adjustSize();
updatedText.str("");
updatedText << "[Mouse: " << mouseTileX << ", " << mouseTileY << "]";
- tileMouseLabel->setCaption(updatedText.str());
- tileMouseLabel->adjustSize();
+ mTileMouseLabel->setCaption(updatedText.str());
+ mTileMouseLabel->adjustSize();
updatedText.str("");
mCurrentMap = engine->getCurrentMap();
@@ -90,13 +90,13 @@ DebugWindow::logic()
{
updatedText << " [Music File: "
<< mCurrentMap->getProperty("music") << "]";
- musicFileLabel->setCaption(updatedText.str());
- musicFileLabel->adjustSize();
+ mMusicFileLabel->setCaption(updatedText.str());
+ mMusicFileLabel->adjustSize();
updatedText.str("");
updatedText << " [MiniMap File: "
<< mCurrentMap->getProperty("minimap") << "]";
- mapFileLabel->setCaption(updatedText.str());
- mapFileLabel->adjustSize();
+ mMapFileLabel->setCaption(updatedText.str());
+ mMapFileLabel->adjustSize();
}
}
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index a2480f79..d318df16 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -57,8 +57,8 @@ class DebugWindow : public Window, public gcn::ActionListener
void action(const std::string &actionId);
private:
- gcn::Label *musicFileLabel, *mapFileLabel;
- gcn::Label *tileMouseLabel, *FPSLabel;
+ gcn::Label *mMusicFileLabel, *mMapFileLabel;
+ gcn::Label *mTileMouseLabel, *mFPSLabel;
Map *mCurrentMap;
};
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 9904af02..61a9ad55 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -42,14 +42,14 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment):
setDefaultSize(5, 230, 200, 90);
loadWindowState();
- itemset = ResourceManager::getInstance()->createSpriteset(
+ mItemset = ResourceManager::getInstance()->createSpriteset(
"graphics/sprites/items.png", 32, 32);
- if (!itemset) logger->error("Unable to load items.png");
+ if (!mItemset) logger->error("Unable to load items.png");
}
EquipmentWindow::~EquipmentWindow()
{
- delete itemset;
+ delete mItemset;
}
void EquipmentWindow::draw(gcn::Graphics *graphics)
@@ -69,7 +69,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
continue;
}
- image = itemset->get(item->getInfo()->getImage() - 1);
+ image = mItemset->get(item->getInfo()->getImage() - 1);
dynamic_cast<Graphics*>(graphics)->drawImage(
image, 36 * (i % 4) + 10, 36 * (i / 4) + 25);
}
@@ -81,7 +81,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
return;
}
- image = itemset->get(item->getInfo()->getImage() - 1);
+ image = mItemset->get(item->getInfo()->getImage() - 1);
dynamic_cast<Graphics*>(graphics)->drawImage(image, 160, 25);
std::stringstream n;
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index d55adb16..aeaae58c 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -53,7 +53,7 @@ class EquipmentWindow : public Window
void draw(gcn::Graphics *graphics);
private:
- Spriteset *itemset;
+ Spriteset *mItemset;
Equipment *mEquipment;
};
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index 94d54f50..ffdb7896 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -31,7 +31,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget)
*/
if (mModalFocusedWidget != NULL && mModalFocusedWidget != widget)
{
- modalStack.push_front(mModalFocusedWidget);
+ mModalStack.push_front(mModalFocusedWidget);
mModalFocusedWidget = NULL;
}
@@ -40,7 +40,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget)
void FocusHandler::releaseModalFocus(gcn::Widget *widget)
{
- modalStack.remove(widget);
+ mModalStack.remove(widget);
if (mModalFocusedWidget == widget)
{
@@ -49,10 +49,10 @@ void FocusHandler::releaseModalFocus(gcn::Widget *widget)
/* Check if there were any previously modal widgets that'd still like
* to regain their modal focus.
*/
- if (modalStack.size() > 0)
+ if (mModalStack.size() > 0)
{
- gcn::FocusHandler::requestModalFocus(modalStack.front());
- modalStack.pop_front();
+ gcn::FocusHandler::requestModalFocus(mModalStack.front());
+ mModalStack.pop_front();
}
}
}
diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h
index 6c9d77cc..252fdd9d 100644
--- a/src/gui/focushandler.h
+++ b/src/gui/focushandler.h
@@ -62,7 +62,7 @@ class FocusHandler : public gcn::FocusHandler
/**
* Stack of widgets that have requested modal forcus.
*/
- std::list<gcn::Widget*> modalStack;
+ std::list<gcn::Widget*> mModalStack;
};
#endif
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index b52ff8e8..7a57cd00 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -241,7 +241,7 @@ Gui::mousePress(int mx, int my, int button)
return;
// Check if we are alive and kickin'
- if (!player_node || player_node->action == Being::DEAD)
+ if (!player_node || player_node->mAction == Being::DEAD)
return;
// Check if we are busy
@@ -294,7 +294,7 @@ Gui::mousePress(int mx, int my, int button)
case Being::MONSTER:
case Being::PLAYER:
- if (being->action == Being::MONSTER_DEAD)
+ if (being->mAction == Being::MONSTER_DEAD)
break;
player_node->attack(being, true);
diff --git a/src/gui/help.cpp b/src/gui/help.cpp
index 7b56d662..6b2eca6b 100644
--- a/src/gui/help.cpp
+++ b/src/gui/help.cpp
@@ -38,20 +38,20 @@ HelpWindow::HelpWindow():
setContentSize(455, 350);
setWindowName("Help");
- browserBox = new BrowserBox();
- browserBox->setOpaque(false);
- scrollArea = new ScrollArea(browserBox);
+ mBrowserBox = new BrowserBox();
+ mBrowserBox->setOpaque(false);
+ mScrollArea = new ScrollArea(mBrowserBox);
Button *okButton = new Button("Close", "close", this);
- scrollArea->setDimension(gcn::Rectangle(
+ mScrollArea->setDimension(gcn::Rectangle(
5, 5, 445, 335 - okButton->getHeight()));
okButton->setPosition(
450 - okButton->getWidth(),
345 - okButton->getHeight());
- browserBox->setLinkHandler(this);
+ mBrowserBox->setLinkHandler(this);
- add(scrollArea);
+ add(mScrollArea);
add(okButton);
setLocationRelativeTo(getParent());
@@ -73,12 +73,12 @@ void HelpWindow::handleLink(const std::string& link)
void HelpWindow::loadHelp(const std::string &helpFile)
{
- browserBox->clearRows();
+ mBrowserBox->clearRows();
loadFile("header");
loadFile(helpFile);
- scrollArea->setVerticalScrollAmount(0);
+ mScrollArea->setVerticalScrollAmount(0);
setVisible(true);
}
@@ -90,6 +90,6 @@ void HelpWindow::loadFile(const std::string &file)
for (unsigned int i = 0; i < lines.size(); ++i)
{
- browserBox->addRow(lines[i]);
+ mBrowserBox->addRow(lines[i]);
}
}
diff --git a/src/gui/help.h b/src/gui/help.h
index 139b9397..44c3d6fc 100644
--- a/src/gui/help.h
+++ b/src/gui/help.h
@@ -63,8 +63,8 @@ class HelpWindow : public Window, public LinkHandler,
private:
void loadFile(const std::string &file);
- BrowserBox* browserBox;
- gcn::ScrollArea *scrollArea;
+ BrowserBox* mBrowserBox;
+ gcn::ScrollArea *mScrollArea;
};
extern HelpWindow *helpWindow;
diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp
index be819de3..560a6cec 100644
--- a/src/gui/inttextbox.cpp
+++ b/src/gui/inttextbox.cpp
@@ -28,7 +28,7 @@
#include <guichan/key.hpp>
IntTextBox::IntTextBox(int i):
- value(i)
+ mValue(i)
{
}
@@ -48,26 +48,26 @@ void IntTextBox::keyPress(const gcn::Key &key)
setInt(i);
}
-void IntTextBox::setRange(int minValue, int maxValue)
+void IntTextBox::setRange(int min, int max)
{
- min = minValue;
- max = maxValue;
+ mMin = min;
+ mMax = max;
}
int IntTextBox::getInt()
{
if (gcn::TextBox::getText() == "")
return 0;
- return value;
+ return mValue;
}
void IntTextBox::setInt(int i)
{
std::stringstream s;
- if (i >= min && i <= max)
- value = i;
- s << value;
+ if (i >= mMin && i <= mMax)
+ mValue = i;
+ s << mValue;
setText(s.str());
setCaretPosition(s.str().length() + 1);
}
diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h
index 580788f4..b199cb2f 100644
--- a/src/gui/inttextbox.h
+++ b/src/gui/inttextbox.h
@@ -58,9 +58,9 @@ class IntTextBox : public TextBox
void keyPress(const gcn::Key &key);
private:
- int min; /**< Minimum value */
- int max; /**< Maximum value */
- int value; /**< Current value */
+ int mMin; /**< Minimum value */
+ int mMax; /**< Maximum value */
+ int mValue; /**< Current value */
};
#endif
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 0c8fb14e..422d92af 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -50,34 +50,33 @@ InventoryWindow::InventoryWindow():
setMinHeight(172);
setDefaultSize(115, 25, 322, 172);
- useButton = new Button("Use", "use", this);
- dropButton = new Button("Drop", "drop", this);
-
- items = new ItemContainer(player_node->mInventory.get());
- invenScroll = new ScrollArea(items);
- invenScroll->setPosition(8, 8);
- invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
-
- itemNameLabel = new gcn::Label("Name:");
- itemDescriptionLabel = new gcn::Label("Description:");
- itemEffectLabel = new gcn::Label("Effect:");
- weightLabel = new gcn::Label("Total Weight: - Maximum Weight: ");
- weightLabel->setPosition(8, 8);
- invenScroll->setPosition(8,
- weightLabel->getY() + weightLabel->getHeight() + 5);
-
- add(useButton);
- add(dropButton);
- add(invenScroll);
- add(itemNameLabel);
- add(itemDescriptionLabel);
- add(itemEffectLabel);
- add(weightLabel);
-
- useButton->setSize(48, useButton->getHeight());
+ mUseButton = new Button("Use", "use", this);
+ mDropButton = new Button("Drop", "drop", this);
+
+ mItems = new ItemContainer(player_node->mInventory.get());
+ mInvenScroll = new ScrollArea(mItems);
+ mInvenScroll->setPosition(8, 8);
+ mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+
+ mItemNameLabel = new gcn::Label("Name:");
+ mItemDescriptionLabel = new gcn::Label("Description:");
+ mItemEffectLabel = new gcn::Label("Effect:");
+ mWeightLabel = new gcn::Label("Total Weight: - Maximum Weight: ");
+ mWeightLabel->setPosition(8, 8);
+ mInvenScroll->setPosition(8,
+ mWeightLabel->getY() + mWeightLabel->getHeight() + 5);
+
+ add(mUseButton);
+ add(mDropButton);
+ add(mInvenScroll);
+ add(mItemNameLabel);
+ add(mItemDescriptionLabel);
+ add(mItemEffectLabel);
+ add(mWeightLabel);
+
+ mUseButton->setSize(48, mUseButton->getHeight());
loadWindowState();
-
}
void InventoryWindow::logic()
@@ -90,15 +89,15 @@ void InventoryWindow::logic()
// Update weight information
std::stringstream tempstr;
- tempstr << "Total Weight: " << player_node->totalWeight
- << " - Maximum Weight: " << player_node->maxWeight;
- weightLabel->setCaption(tempstr.str());
- weightLabel->adjustSize();
+ tempstr << "Total Weight: " << player_node->mTotalWeight
+ << " - Maximum Weight: " << player_node->mMaxWeight;
+ mWeightLabel->setCaption(tempstr.str());
+ mWeightLabel->adjustSize();
}
void InventoryWindow::action(const std::string &eventId)
{
- Item *item = items->getItem();
+ Item *item = mItems->getItem();
if (!item) {
return;
@@ -128,7 +127,7 @@ void InventoryWindow::mouseClick(int x, int y, int button, int count)
{
Window::mouseClick(x, y, button, count);
- Item *item = items->getItem();
+ Item *item = mItems->getItem();
if (!item) {
return;
@@ -137,14 +136,14 @@ void InventoryWindow::mouseClick(int x, int y, int button, int count)
// Show Name and Description
std::string SomeText;
SomeText = "Name: " + item->getInfo()->getName();
- itemNameLabel->setCaption(SomeText);
- itemNameLabel->adjustSize();
+ mItemNameLabel->setCaption(SomeText);
+ mItemNameLabel->adjustSize();
SomeText = "Effect: " + item->getInfo()->getEffect();
- itemEffectLabel->setCaption(SomeText);
- itemEffectLabel->adjustSize();
+ mItemEffectLabel->setCaption(SomeText);
+ mItemEffectLabel->adjustSize();
SomeText = "Description: " + item->getInfo()->getDescription();
- itemDescriptionLabel->setCaption(SomeText);
- itemDescriptionLabel->adjustSize();
+ mItemDescriptionLabel->setCaption(SomeText);
+ mItemDescriptionLabel->adjustSize();
if (button == gcn::MouseInput::RIGHT)
{
@@ -179,42 +178,42 @@ void InventoryWindow::updateWidgets()
}
// Resize widgets
- useButton->setPosition(8, height - 24);
- dropButton->setPosition(48 + 16, height - 24);
- invenScroll->setSize(width - 16, height - 110);
-
- itemNameLabel->setPosition(8,
- invenScroll->getY() + invenScroll->getHeight() + 4);
- itemEffectLabel->setPosition(8,
- itemNameLabel->getY() + itemNameLabel->getHeight() + 4);
- itemDescriptionLabel->setPosition(8,
- itemEffectLabel->getY() + itemEffectLabel->getHeight() + 4);
+ mUseButton->setPosition(8, height - 24);
+ mDropButton->setPosition(48 + 16, height - 24);
+ mInvenScroll->setSize(width - 16, height - 110);
+
+ mItemNameLabel->setPosition(8,
+ mInvenScroll->getY() + mInvenScroll->getHeight() + 4);
+ mItemEffectLabel->setPosition(8,
+ mItemNameLabel->getY() + mItemNameLabel->getHeight() + 4);
+ mItemDescriptionLabel->setPosition(8,
+ mItemEffectLabel->getY() + mItemEffectLabel->getHeight() + 4);
}
void InventoryWindow::updateButtons()
{
Item *item;
- if ((item = items->getItem()) && item->isEquipment())
+ if ((item = mItems->getItem()) && item->isEquipment())
{
if (item->isEquipped()) {
- useButton->setCaption("Unequip");
+ mUseButton->setCaption("Unequip");
}
else {
- useButton->setCaption("Equip");
+ mUseButton->setCaption("Equip");
}
}
else {
- useButton ->setCaption("Use");
+ mUseButton ->setCaption("Use");
}
- useButton->setEnabled(!!item);
- dropButton->setEnabled(!!item);
+ mUseButton->setEnabled(!!item);
+ mDropButton->setEnabled(!!item);
}
Item* InventoryWindow::getItem()
{
- return items->getItem();
+ return mItems->getItem();
}
void InventoryWindow::loadWindowState()
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 17c4888a..f588fa8e 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -73,14 +73,14 @@ class InventoryWindow : public Window, gcn::ActionListener
void updateWidgets(); /** Updates widgets size/position */
- ItemContainer *items;
-
- gcn::Button *useButton, *dropButton;
- gcn::ScrollArea *invenScroll;
- gcn::Label *itemNameLabel;
- gcn::Label *itemDescriptionLabel;
- gcn::Label *itemEffectLabel;
- gcn::Label *weightLabel;
+ ItemContainer *mItems;
+
+ gcn::Button *mUseButton, *mDropButton;
+ gcn::ScrollArea *mInvenScroll;
+ gcn::Label *mItemNameLabel;
+ gcn::Label *mItemDescriptionLabel;
+ gcn::Label *mItemEffectLabel;
+ gcn::Label *mWeightLabel;
};
extern InventoryWindow *inventoryWindow;
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index cc42066a..874c0b63 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -42,22 +42,22 @@ ItemContainer::ItemContainer(Inventory *inventory):
mInventory(inventory)
{
ResourceManager *resman = ResourceManager::getInstance();
- itemset = resman->createSpriteset("graphics/sprites/items.png", 32, 32);
- if (!itemset) logger->error("Unable to load items.png");
+ mItemset = resman->createSpriteset("graphics/sprites/items.png", 32, 32);
+ if (!mItemset) logger->error("Unable to load items.png");
- selImg = resman->getImage("graphics/gui/selection.png");
- if (!selImg) logger->error("Unable to load selection.png");
+ mSelImg = resman->getImage("graphics/gui/selection.png");
+ if (!mSelImg) logger->error("Unable to load selection.png");
- selectedItem = 0; // No item selected
- maxItems = mInventory->getLastUsedSlot() - 1; // Count from 0, usage from 2
+ mSelectedItem = 0; // No item selected
+ mMaxItems = mInventory->getLastUsedSlot() - 1; // Count from 0, usage from 2
addMouseListener(this);
}
ItemContainer::~ItemContainer()
{
- delete itemset;
- selImg->decRef();
+ delete mItemset;
+ mSelImg->decRef();
}
void ItemContainer::logic()
@@ -66,16 +66,16 @@ void ItemContainer::logic()
int i = mInventory->getLastUsedSlot() - 1; // Count from 0, usage from 2
- if (i != maxItems) {
- maxItems = i;
+ if (i != mMaxItems) {
+ mMaxItems = i;
setWidth(getWidth());
}
}
void ItemContainer::draw(gcn::Graphics* graphics)
{
- int gridWidth = itemset->get(0)->getWidth() + 4;
- int gridHeight = itemset->get(0)->getHeight() + 10;
+ int gridWidth = mItemset->get(0)->getWidth() + 4;
+ int gridHeight = mItemset->get(0)->getHeight() + 10;
int w = getWidth();
int columns = w / gridWidth;
@@ -87,9 +87,9 @@ void ItemContainer::draw(gcn::Graphics* graphics)
// Reset selected item when quantity not above 0 (should probably be made
// sure somewhere else)
- if (selectedItem && selectedItem->getQuantity() <= 0)
+ if (mSelectedItem && mSelectedItem->getQuantity() <= 0)
{
- selectedItem = 0;
+ mSelectedItem = 0;
}
/*
@@ -108,10 +108,10 @@ void ItemContainer::draw(gcn::Graphics* graphics)
int itemY = ((i - 2) / columns) * gridHeight;
// Draw selection image below selected item
- if (selectedItem == item)
+ if (mSelectedItem == item)
{
dynamic_cast<Graphics*>(graphics)->drawImage(
- selImg, itemX, itemY);
+ mSelImg, itemX, itemY);
}
// Draw item icon
@@ -119,7 +119,7 @@ void ItemContainer::draw(gcn::Graphics* graphics)
if ((idx = item->getInfo()->getImage()) > 0)
{
dynamic_cast<Graphics*>(graphics)->drawImage(
- itemset->get(idx - 1), itemX, itemY);
+ mItemset->get(idx - 1), itemX, itemY);
}
// Draw item caption
@@ -143,8 +143,8 @@ void ItemContainer::setWidth(int width)
{
gcn::Widget::setWidth(width);
- int gridWidth = itemset->get(0)->getWidth() + 4;
- int gridHeight = itemset->get(0)->getHeight() + 14;
+ int gridWidth = mItemset->get(0)->getWidth() + 4;
+ int gridHeight = mItemset->get(0)->getHeight() + 14;
int columns = getWidth() / gridWidth;
if (columns < 1)
@@ -152,24 +152,24 @@ void ItemContainer::setWidth(int width)
columns = 1;
}
- setHeight(((maxItems / columns) +
- (maxItems % columns > 0 ? 1 : 0)) * gridHeight);
+ setHeight(((mMaxItems / columns) +
+ (mMaxItems % columns > 0 ? 1 : 0)) * gridHeight);
}
Item* ItemContainer::getItem()
{
- return selectedItem;
+ return mSelectedItem;
}
void ItemContainer::selectNone()
{
- selectedItem = 0;
+ mSelectedItem = 0;
}
void ItemContainer::mousePress(int mx, int my, int button)
{
- int gridWidth = itemset->get(0)->getWidth() + 4;
- int gridHeight = itemset->get(0)->getHeight() + 10;
+ int gridWidth = mItemset->get(0)->getWidth() + 4;
+ int gridHeight = mItemset->get(0)->getHeight() + 10;
int w = getWidth();
int columns = w / gridWidth;
@@ -180,6 +180,6 @@ void ItemContainer::mousePress(int mx, int my, int button)
if (index > INVENTORY_SIZE) {
index = INVENTORY_SIZE - 1;
}
- selectedItem = mInventory->getItem(index);
+ mSelectedItem = mInventory->getItem(index);
}
}
diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h
index 69134d83..63e8bf47 100644
--- a/src/gui/itemcontainer.h
+++ b/src/gui/itemcontainer.h
@@ -83,11 +83,11 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener
private:
Inventory *mInventory;
- Spriteset *itemset;
- Image *selImg;
- Item *selectedItem;
+ Spriteset *mItemset;
+ Image *mSelImg;
+ Item *mSelectedItem;
- int maxItems;
+ int mMaxItems;
};
#endif
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 691b6406..d6c8bfea 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -39,7 +39,7 @@
void
WrongDataNoticeListener::setTarget(gcn::TextField *textField)
{
- this->target = textField;
+ this->mTarget = textField;
}
void
@@ -48,25 +48,25 @@ WrongDataNoticeListener::action(const std::string &eventId)
if (eventId == "ok")
{
// Reset the field
- target->setText("");
- target->setCaretPosition(0);
- target->requestFocus();
+ mTarget->setText("");
+ mTarget->setCaretPosition(0);
+ mTarget->requestFocus();
}
}
LoginDialog::LoginDialog(LoginData *loginData):
Window("Login"), mLoginData(loginData)
{
- userLabel = new gcn::Label("Name:");
- passLabel = new gcn::Label("Password:");
- serverLabel = new gcn::Label("Server:");
- userField = new TextField(mLoginData->username);
- passField = new PasswordField(mLoginData->password);
- serverField = new TextField(mLoginData->hostname);
- keepCheck = new CheckBox("Keep", false);
- okButton = new Button("OK", "ok", this);
- cancelButton = new Button("Cancel", "cancel", this);
- registerButton = new Button("Register", "register", this);
+ gcn::Label *userLabel = new gcn::Label("Name:");
+ gcn::Label *passLabel = new gcn::Label("Password:");
+ gcn::Label *serverLabel = new gcn::Label("Server:");
+ mUserField = new TextField(mLoginData->username);
+ mPassField = new PasswordField(mLoginData->password);
+ mServerField = new TextField(mLoginData->hostname);
+ mKeepCheck = new CheckBox("Keep", false);
+ mOkButton = new Button("OK", "ok", this);
+ mCancelButton = new Button("Cancel", "cancel", this);
+ mRegisterButton = new Button("Register", "register", this);
setContentSize(200, 100);
@@ -74,58 +74,58 @@ LoginDialog::LoginDialog(LoginData *loginData):
passLabel->setPosition(5, 14 + userLabel->getHeight());
serverLabel->setPosition(
5, 23 + userLabel->getHeight() + passLabel->getHeight());
- userField->setPosition(65, 5);
- passField->setPosition(65, 14 + userLabel->getHeight());
- serverField->setPosition(
+ mUserField->setPosition(65, 5);
+ mPassField->setPosition(65, 14 + userLabel->getHeight());
+ mServerField->setPosition(
65, 23 + userLabel->getHeight() + passLabel->getHeight());
- userField->setWidth(130);
- passField->setWidth(130);
- serverField->setWidth(130);
- keepCheck->setPosition(4, 77);
- keepCheck->setMarked(mLoginData->remember);
- cancelButton->setPosition(
- 200 - cancelButton->getWidth() - 5,
- 100 - cancelButton->getHeight() - 5);
- okButton->setPosition(
- cancelButton->getX() - okButton->getWidth() - 5,
- 100 - okButton->getHeight() - 5);
- registerButton->setPosition(keepCheck->getX() + keepCheck->getWidth() + 10,
- 100 - registerButton->getHeight() - 5);
-
- userField->setEventId("ok");
- passField->setEventId("ok");
- serverField->setEventId("ok");
-
- userField->addActionListener(this);
- passField->addActionListener(this);
- serverField->addActionListener(this);
- keepCheck->addActionListener(this);
+ mUserField->setWidth(130);
+ mPassField->setWidth(130);
+ mServerField->setWidth(130);
+ mKeepCheck->setPosition(4, 77);
+ mKeepCheck->setMarked(mLoginData->remember);
+ mCancelButton->setPosition(
+ 200 - mCancelButton->getWidth() - 5,
+ 100 - mCancelButton->getHeight() - 5);
+ mOkButton->setPosition(
+ mCancelButton->getX() - mOkButton->getWidth() - 5,
+ 100 - mOkButton->getHeight() - 5);
+ mRegisterButton->setPosition(mKeepCheck->getX() + mKeepCheck->getWidth() + 10,
+ 100 - mRegisterButton->getHeight() - 5);
+
+ mUserField->setEventId("ok");
+ mPassField->setEventId("ok");
+ mServerField->setEventId("ok");
+
+ mUserField->addActionListener(this);
+ mPassField->addActionListener(this);
+ mServerField->addActionListener(this);
+ mKeepCheck->addActionListener(this);
add(userLabel);
add(passLabel);
add(serverLabel);
- add(userField);
- add(passField);
- add(serverField);
- add(keepCheck);
- add(okButton);
- add(cancelButton);
- add(registerButton);
+ add(mUserField);
+ add(mPassField);
+ add(mServerField);
+ add(mKeepCheck);
+ add(mOkButton);
+ add(mCancelButton);
+ add(mRegisterButton);
setLocationRelativeTo(getParent());
- if (!userField->getText().length()) {
- userField->requestFocus();
+ if (!mUserField->getText().length()) {
+ mUserField->requestFocus();
} else {
- passField->requestFocus();
+ mPassField->requestFocus();
}
- wrongDataNoticeListener = new WrongDataNoticeListener();
+ mWrongDataNoticeListener = new WrongDataNoticeListener();
}
LoginDialog::~LoginDialog()
{
- delete wrongDataNoticeListener;
+ delete mWrongDataNoticeListener;
}
void
@@ -134,22 +134,22 @@ LoginDialog::action(const std::string& eventId)
if (eventId == "ok")
{
// Check login
- if (userField->getText().length() == 0)
+ if (mUserField->getText().length() == 0)
{
- wrongDataNoticeListener->setTarget(this->passField);
+ mWrongDataNoticeListener->setTarget(this->mPassField);
OkDialog *dlg = new OkDialog("Error", "Enter your username first");
- dlg->addActionListener(wrongDataNoticeListener);
+ dlg->addActionListener(mWrongDataNoticeListener);
}
else
{
- mLoginData->hostname = serverField->getText();
- mLoginData->username = userField->getText();
- mLoginData->password = passField->getText();
- mLoginData->remember = keepCheck->isMarked();
-
- okButton->setEnabled(false);
- //cancelButton->setEnabled(false);
- registerButton->setEnabled(false);
+ mLoginData->hostname = mServerField->getText();
+ mLoginData->username = mUserField->getText();
+ mLoginData->password = mPassField->getText();
+ mLoginData->remember = mKeepCheck->isMarked();
+
+ mOkButton->setEnabled(false);
+ //mCancelButton->setEnabled(false);
+ mRegisterButton->setEnabled(false);
state = ACCOUNT_STATE;
}
diff --git a/src/gui/login.h b/src/gui/login.h
index 9e6dc6b4..39548950 100644
--- a/src/gui/login.h
+++ b/src/gui/login.h
@@ -40,7 +40,7 @@ class WrongDataNoticeListener : public gcn::ActionListener {
void setTarget(gcn::TextField *textField);
void action(const std::string &eventId);
private:
- gcn::TextField *target;
+ gcn::TextField *mTarget;
};
/**
@@ -68,18 +68,15 @@ class LoginDialog : public Window, public gcn::ActionListener {
void action(const std::string& eventId);
private:
- gcn::Label *userLabel;
- gcn::Label *passLabel;
- gcn::Label *serverLabel;
- gcn::TextField *userField;
- gcn::TextField *passField;
- gcn::TextField *serverField;
- gcn::CheckBox *keepCheck;
- gcn::Button *okButton;
- gcn::Button *cancelButton;
- gcn::Button *registerButton;
+ gcn::TextField *mUserField;
+ gcn::TextField *mPassField;
+ gcn::TextField *mServerField;
+ gcn::CheckBox *mKeepCheck;
+ gcn::Button *mOkButton;
+ gcn::Button *mCancelButton;
+ gcn::Button *mRegisterButton;
- WrongDataNoticeListener *wrongDataNoticeListener;
+ WrongDataNoticeListener *mWrongDataNoticeListener;
LoginData *mLoginData;
};
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index d0c52b11..9d414b8b 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -105,7 +105,7 @@ void Minimap::draw(gcn::Graphics *graphics)
int offset = (dotSize - 1) / 2;
graphics->fillRectangle(gcn::Rectangle(
- being->x / 2 + getPadding() - offset,
- being->y / 2 + getTitleBarHeight() - offset, 1, 1));
+ being->mX / 2 + getPadding() - offset,
+ being->mY / 2 + getTitleBarHeight() - offset, 1, 1));
}
}
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index f83b3724..4f070acd 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -40,65 +40,71 @@ MiniStatusWindow::MiniStatusWindow():
setMovable(false);
setTitleBarHeight(0);
- hpBar = new ProgressBar(1.0f,
+ mHpBar = new ProgressBar(1.0f,
0, 3, 100, 20,
0, 171, 34);
- mpBar = new ProgressBar(1.0f,
- hpBar->getX() + hpBar->getWidth() + 3,
- hpBar->getY(), 100, 20, 26, 102, 230);
+ mMpBar = new ProgressBar(1.0f,
+ mHpBar->getX() + mHpBar->getWidth() + 3,
+ mHpBar->getY(), 100, 20, 26, 102, 230);
- hpLabel = new gcn::Label("");
- mpLabel = new gcn::Label("");
- hpLabel->setForegroundColor(gcn::Color(255, 255, 255));
- mpLabel->setForegroundColor(gcn::Color(255, 255, 255));
- hpLabel->setFont(speechFont);
- mpLabel->setFont(speechFont);
+ mHpLabel = new gcn::Label("");
+ mMpLabel = new gcn::Label("");
+ mHpLabel->setForegroundColor(gcn::Color(255, 255, 255));
+ mMpLabel->setForegroundColor(gcn::Color(255, 255, 255));
+ mHpLabel->setFont(speechFont);
+ mMpLabel->setFont(speechFont);
- add(hpBar);
- add(mpBar);
- add(hpLabel);
- add(mpLabel);
+ add(mHpBar);
+ add(mMpBar);
+ add(mHpLabel);
+ add(mMpLabel);
- setDefaultSize(0, 0, mpBar->getX() + mpBar->getWidth(),
- mpBar->getY() + mpBar->getHeight());
+ setDefaultSize(0, 0, mMpBar->getX() + mMpBar->getWidth(),
+ mMpBar->getY() + mMpBar->getHeight());
}
void MiniStatusWindow::update()
{
// HP Bar coloration
- if (player_node->hp < int(player_node->maxHp / 3))
+ if (player_node->mHp < int(player_node->mMaxHp / 3))
{
- hpBar->setColor(223, 32, 32); // Red
+ mHpBar->setColor(223, 32, 32); // Red
}
else
{
- if (player_node->hp < int((player_node->maxHp / 3) * 2))
+ if (player_node->mHp < int((player_node->mMaxHp / 3) * 2))
{
- hpBar->setColor(230, 171, 34); // Orange
+ mHpBar->setColor(230, 171, 34); // Orange
}
else
{
- hpBar->setColor(0, 171, 34); // Green
+ mHpBar->setColor(0, 171, 34); // Green
}
}
- hpBar->setProgress((float)player_node->hp / (float)player_node->maxHp);
+ mHpBar->setProgress((float)player_node->mHp / (float)player_node->mMaxHp);
// mpBar->setProgress((float)player_node->mp / (float)player_node->maxMp);
// Update and center labels
std::stringstream updatedText;
- updatedText << player_node->hp;
- hpLabel->setCaption(updatedText.str());
- hpLabel->adjustSize();
+ updatedText << player_node->mHp;
+ mHpLabel->setCaption(updatedText.str());
+ mHpLabel->adjustSize();
updatedText.str("");
- updatedText << player_node->mp;
- mpLabel->setCaption(updatedText.str());
- mpLabel->adjustSize();
- hpLabel->setPosition(hpBar->getX() + int((hpBar->getWidth() / 2) - (hpLabel->getWidth() / 2)),
- hpBar->getY() + int((hpBar->getHeight() / 2) - (hpLabel->getHeight() / 2)));
- mpLabel->setPosition(mpBar->getX() + int((mpBar->getWidth() / 2) - (mpLabel->getWidth() / 2)),
- mpBar->getY() + int((mpBar->getHeight() / 2) - (mpLabel->getHeight() / 2)));
+ updatedText << player_node->mMp;
+ mMpLabel->setCaption(updatedText.str());
+ mMpLabel->adjustSize();
+ mHpLabel->setPosition(
+ mHpBar->getX() +
+ int((mHpBar->getWidth() / 2) - (mHpLabel->getWidth() / 2)),
+ mHpBar->getY() +
+ int((mHpBar->getHeight() / 2) - (mHpLabel->getHeight() / 2)));
+ mMpLabel->setPosition(
+ mMpBar->getX() +
+ int((mMpBar->getWidth() / 2) - (mMpLabel->getWidth() / 2)),
+ mMpBar->getY() +
+ int((mMpBar->getHeight() / 2) - (mMpLabel->getHeight() / 2)));
}
void MiniStatusWindow::draw(gcn::Graphics *graphics)
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index 0b081f47..b5d149e7 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -59,8 +59,8 @@ class MiniStatusWindow : public Window
/**
* Mini Status Bars
*/
- ProgressBar *hpBar, *mpBar;
- gcn::Label *hpLabel, *mpLabel;
+ ProgressBar *mHpBar, *mMpBar;
+ gcn::Label *mHpLabel, *mMpLabel;
};
#endif
diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp
index c04ad6a0..be62cd5f 100644
--- a/src/gui/newskill.cpp
+++ b/src/gui/newskill.cpp
@@ -75,23 +75,24 @@ NewSkillDialog::NewSkillDialog():
startPoint = 0;
for ( int i = 0; i < N_SKILL_CAT_SIZE; i++)
{
- skillLabel[i] = new gcn::Label("Empty ");
- skillLevel[i] = new gcn::Label("00000");
- skillbar[i] = new ProgressBar(0.0f,0,0,100,15,0,0,255);
- skillLevel[i]->setAlignment(Graphics::RIGHT);
- add(skillLabel[i],40,5+i*25);
- add(skillLevel[i],150,5+i*25);
- add(skillbar[i],180,5+i*25);
+ mSkillLabel[i] = new gcn::Label("Empty ");
+ mSkillLevel[i] = new gcn::Label("00000");
+ mSkillbar[i] = new ProgressBar(0.0f,0,0,100,15,0,0,255);
+ mSkillLevel[i]->setAlignment(Graphics::RIGHT);
+ add(mSkillLabel[i],40,5+i*25);
+ add(mSkillLevel[i],150,5+i*25);
+ add(mSkillbar[i],180,5+i*25);
}
// initialize the skills
for(int i=0;i<N_SKILL;i++)
{
- playerSkill[i].level = 0;
- playerSkill[i].exp = 0;
+ mPlayerSkill[i].level = 0;
+ mPlayerSkill[i].exp = 0;
}
resetNSD();
// create controls
+ Button *catButton[N_SKILL_CAT];
catButton[0] = new Button("Weapons", "g1", this);
catButton[1] = new Button("Magic", "g2", this);
catButton[2] = new Button("Craft", "g3", this);
@@ -101,43 +102,18 @@ NewSkillDialog::NewSkillDialog():
catButton[6] = new Button("S. Resist", "g7", this);
catButton[7] = new Button("Hunting", "g8", this);
catButton[8] = new Button("Stat", "g9", this);
- closeButton = new Button("Close", "close", this);
- // captions
-
- // positioning
setContentSize(350, 250);
- catButton[0]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[0]->setPosition(290, 0);
- catButton[1]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[1]->setPosition(290, 20);
- catButton[2]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[2]->setPosition(290, 40);
- catButton[3]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[3]->setPosition(290, 60);
- catButton[4]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[4]->setPosition(290, 80);
- catButton[5]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[5]->setPosition(290, 100);
- catButton[6]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[6]->setPosition(290, 120);
- catButton[7]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[7]->setPosition(290, 140);
- catButton[8]->setDimension(gcn::Rectangle(0,0,60,20));
- catButton[8]->setPosition(290, 160);
+
+ for (int i = 0; i < 9; ++i) {
+ catButton[i]->setDimension(gcn::Rectangle(0, 0, 60, 20));
+ catButton[i]->setPosition(290, 20 * i);
+ add(catButton[i]);
+ }
+
+ Button *closeButton = new Button("Close", "close", this);
closeButton->setDimension(gcn::Rectangle(0,0,60,20));
closeButton->setPosition(290, 230);
-
- // add controls
- add(catButton[0]);
- add(catButton[1]);
- add(catButton[2]);
- add(catButton[3]);
- add(catButton[4]);
- add(catButton[5]);
- add(catButton[6]);
- add(catButton[7]);
- add(catButton[8]);
add(closeButton);
// finsihing touches
@@ -199,20 +175,20 @@ void NewSkillDialog::resetNSD()
{
if(skill_name[a+startPoint] != "")
{
- skillLabel[a]->setCaption(skill_name[a+startPoint]);
- skillLabel[a]->setVisible(true);
+ mSkillLabel[a]->setCaption(skill_name[a+startPoint]);
+ mSkillLabel[a]->setVisible(true);
char tmp[5];
- sprintf(tmp, "%d",playerSkill[a+startPoint].level);
- skillLevel[a]->setCaption(tmp);
- skillLevel[a]->setVisible(true);
- skillbar[a]->setProgress(0.0f);
- skillbar[a]->setVisible(true);
+ sprintf(tmp, "%d",mPlayerSkill[a+startPoint].level);
+ mSkillLevel[a]->setCaption(tmp);
+ mSkillLevel[a]->setVisible(true);
+ mSkillbar[a]->setProgress(0.0f);
+ mSkillbar[a]->setVisible(true);
}
else
{
- skillLevel[a]->setVisible(false);
- skillLabel[a]->setVisible(false);
- skillbar[a]->setVisible(false);
+ mSkillLevel[a]->setVisible(false);
+ mSkillLabel[a]->setVisible(false);
+ mSkillbar[a]->setVisible(false);
}
}
}
diff --git a/src/gui/newskill.h b/src/gui/newskill.h
index 58948729..96bcf9ad 100644
--- a/src/gui/newskill.h
+++ b/src/gui/newskill.h
@@ -62,12 +62,10 @@ class NewSkillDialog : public Window, public gcn::ActionListener
// members
int startPoint; // starting point of skill listing
- ProgressBar *skillbar[N_SKILL_CAT_SIZE];
- gcn::Label *skillLabel[N_SKILL_CAT_SIZE];
- gcn::Label *skillLevel[N_SKILL_CAT_SIZE];
- gcn::Button *catButton[N_SKILL_CAT];
- gcn::Button *closeButton;
- nSkill playerSkill[N_SKILL]; // pointer to an array of skill values
+ ProgressBar *mSkillbar[N_SKILL_CAT_SIZE];
+ gcn::Label *mSkillLabel[N_SKILL_CAT_SIZE];
+ gcn::Label *mSkillLevel[N_SKILL_CAT_SIZE];
+ nSkill mPlayerSkill[N_SKILL]; // pointer to an array of skill values
};
#endif
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 34597627..2d12986d 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -64,13 +64,13 @@ NpcListDialog::NpcListDialog():
int
NpcListDialog::getNumberOfElements()
{
- return items.size();
+ return mItems.size();
}
std::string
NpcListDialog::getElementAt(int i)
{
- return items[i];
+ return mItems[i];
}
void
@@ -80,14 +80,14 @@ NpcListDialog::parseItems(const std::string &itemString)
std::string tmp;
while(getline(iss, tmp, ':')) {
- items.push_back(tmp);
+ mItems.push_back(tmp);
}
}
void
NpcListDialog::reset()
{
- items.clear();
+ mItems.clear();
}
void
diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h
index 8b98076e..7d649450 100644
--- a/src/gui/npclistdialog.h
+++ b/src/gui/npclistdialog.h
@@ -85,7 +85,7 @@ class NpcListDialog : public Window, public gcn::ActionListener,
private:
gcn::ListBox *mItemList;
- std::vector<std::string> items;
+ std::vector<std::string> mItems;
};
#endif
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 34283b4c..8174ad77 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -41,9 +41,9 @@ int PlayerBox::instances = 0;
ImageRect PlayerBox::background;
PlayerBox::PlayerBox():
- hairColor(0),
- hairStyle(0),
- showPlayer(false)
+ mHairColor(0),
+ mHairStyle(0),
+ mShowPlayer(false)
{
setBorderSize(2);
@@ -84,7 +84,7 @@ PlayerBox::~PlayerBox()
void PlayerBox::draw(gcn::Graphics *graphics)
{
- if (!showPlayer) {
+ if (!mShowPlayer) {
return;
}
@@ -93,13 +93,13 @@ void PlayerBox::draw(gcn::Graphics *graphics)
playerset->get(0), 23, 12);
// Draw his hair
- if (hairColor >= 0 && hairStyle >= 0 &&
- hairColor < NR_HAIR_COLORS && hairStyle < NR_HAIR_STYLES)
+ if (mHairColor >= 0 && mHairStyle >= 0 &&
+ mHairColor < NR_HAIR_COLORS && mHairStyle < NR_HAIR_STYLES)
{
- int hf = 9 * hairColor;
- if (hf >= 0 && hf < (int)hairset[hairStyle]->size()) {
+ int hf = 9 * mHairColor;
+ if (hf >= 0 && hf < (int)hairset[mHairStyle]->size()) {
dynamic_cast<Graphics*>(graphics)->drawImage(
- hairset[hairStyle]->get(hf), 35, 7);
+ hairset[mHairStyle]->get(hf), 35, 7);
}
}
}
diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h
index 0f1a653f..86e911e9 100644
--- a/src/gui/playerbox.h
+++ b/src/gui/playerbox.h
@@ -57,9 +57,9 @@ class PlayerBox : public gcn::ScrollArea
*/
void drawBorder(gcn::Graphics *graphics);
- int hairColor; /**< The hair color index */
- int hairStyle; /**< The hair style index */
- bool showPlayer; /**< Wether to show the player or not */
+ int mHairColor; /**< The hair color index */
+ int mHairStyle; /**< The hair style index */
+ bool mShowPlayer; /**< Wether to show the player or not */
private:
static int instances;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 464242f1..59316de1 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -54,18 +54,18 @@ PopupMenu::PopupMenu():
setTitleBarHeight(0);
mShowTitle = false;
- browserBox = new BrowserBox();
- browserBox->setPosition(4, 4);
- browserBox->setHighlightMode(BrowserBox::BACKGROUND);
- browserBox->setOpaque(false);
- add(browserBox);
- browserBox->setLinkHandler(this);
+ mBrowserBox = new BrowserBox();
+ mBrowserBox->setPosition(4, 4);
+ mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND);
+ mBrowserBox->setOpaque(false);
+ add(mBrowserBox);
+ mBrowserBox->setLinkHandler(this);
}
void PopupMenu::showPopup(int x, int y, Being *being)
{
mBeing = being;
- browserBox->clearRows();
+ mBrowserBox->clearRows();
switch (mBeing->getType())
{
@@ -74,18 +74,18 @@ void PopupMenu::showPopup(int x, int y, Being *being)
// Players can be traded with. Later also attack, follow and
// add as buddy will be options in this menu.
const std::string &name = mBeing->getName();
- browserBox->addRow("@@trade|Trade With " + name + "@@");
+ mBrowserBox->addRow("@@trade|Trade With " + name + "@@");
- browserBox->addRow("@@attack|Attack " + name + "@@");
- //browserBox->addRow("@@follow|Follow " + name + "@@");
- //browserBox->addRow("@@buddy|Add " + name + " to Buddy List@@");
+ mBrowserBox->addRow("@@attack|Attack " + name + "@@");
+ //mBrowserBox->addRow("@@follow|Follow " + name + "@@");
+ //mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@");
}
break;
case Being::NPC:
// NPCs can be talked to (single option, candidate for removal
// unless more options would be added)
- browserBox->addRow("@@talk|Talk To NPC@@");
+ mBrowserBox->addRow("@@talk|Talk To NPC@@");
break;
default:
@@ -94,8 +94,8 @@ void PopupMenu::showPopup(int x, int y, Being *being)
}
//browserBox->addRow("@@look|Look To@@");
- browserBox->addRow("##3---");
- browserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow("##3---");
+ mBrowserBox->addRow("@@cancel|Cancel@@");
showPopup(x, y);
}
@@ -103,15 +103,15 @@ void PopupMenu::showPopup(int x, int y, Being *being)
void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
{
mFloorItem = floorItem;
- browserBox->clearRows();
+ mBrowserBox->clearRows();
// Floor item can be picked up (single option, candidate for removal)
std::string name = itemDb->getItemInfo(mFloorItem->getItemId())->getName();
- browserBox->addRow("@@pickup|Pick Up " + name + "@@");
+ mBrowserBox->addRow("@@pickup|Pick Up " + name + "@@");
//browserBox->addRow("@@look|Look To@@");
- browserBox->addRow("##3---");
- browserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow("##3---");
+ mBrowserBox->addRow("@@cancel|Cancel@@");
showPopup(x, y);
}
@@ -225,29 +225,29 @@ void PopupMenu::showPopup(int x, int y, Item *item)
{
assert(item);
mItem = item;
- browserBox->clearRows();
+ mBrowserBox->clearRows();
if (item->isEquipment())
{
if (item->isEquipped())
- browserBox->addRow("@@use|Unequip@@");
+ mBrowserBox->addRow("@@use|Unequip@@");
else
- browserBox->addRow("@@use|Equip@@");
+ mBrowserBox->addRow("@@use|Equip@@");
}
else
- browserBox->addRow("@@use|Use@@");
+ mBrowserBox->addRow("@@use|Use@@");
- browserBox->addRow("@@drop|Drop@@");
- browserBox->addRow("@@description|Description@@");
- browserBox->addRow("##3---");
- browserBox->addRow("@@cancel|Cancel@@");
+ mBrowserBox->addRow("@@drop|Drop@@");
+ mBrowserBox->addRow("@@description|Description@@");
+ mBrowserBox->addRow("##3---");
+ mBrowserBox->addRow("@@cancel|Cancel@@");
showPopup(x, y);
}
void PopupMenu::showPopup(int x, int y)
{
- setContentSize(browserBox->getWidth() + 8, browserBox->getHeight() + 8);
+ setContentSize(mBrowserBox->getWidth() + 8, mBrowserBox->getHeight() + 8);
if (windowContainer->getWidth() < (x + getWidth() + 5))
x -= (getWidth() + 50);
if (windowContainer->getHeight() < (y + getHeight() + 5))
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index dfbb2e92..9fe9f866 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -67,7 +67,7 @@ class PopupMenu : public Window, public LinkHandler
void handleLink(const std::string& link);
private:
- BrowserBox* browserBox;
+ BrowserBox* mBrowserBox;
Being* mBeing;
FloorItem* mFloorItem;
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index b86375d4..a5e511b3 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -44,83 +44,83 @@
RegisterDialog::RegisterDialog(LoginData *loginData):
Window("Register"), mLoginData(loginData)
{
- userLabel = new gcn::Label("Name:");
- passwordLabel = new gcn::Label("Password:");
- confirmLabel = new gcn::Label("Confirm:");
- serverLabel = new gcn::Label("Server:");
- userField = new TextField("player");
- passwordField = new PasswordField();
- confirmField = new PasswordField();
- serverField = new TextField();
- maleButton = new RadioButton("Male", "sex", true);
- maleButton->setEnabled(false);
- femaleButton = new RadioButton("Female", "sex", false);
- femaleButton->setEnabled(false);
- registerButton = new Button("Register", "register", this);
- cancelButton = new Button("Cancel", "cancel", this);
+ gcn::Label *userLabel = new gcn::Label("Name:");
+ gcn::Label *passwordLabel = new gcn::Label("Password:");
+ gcn::Label *confirmLabel = new gcn::Label("Confirm:");
+ gcn::Label *serverLabel = new gcn::Label("Server:");
+ mUserField = new TextField("player");
+ mPasswordField = new PasswordField();
+ mConfirmField = new PasswordField();
+ mServerField = new TextField();
+ mMaleButton = new RadioButton("Male", "sex", true);
+ mMaleButton->setEnabled(false);
+ mFemaleButton = new RadioButton("Female", "sex", false);
+ mFemaleButton->setEnabled(false);
+ mRegisterButton = new Button("Register", "register", this);
+ mCancelButton = new Button("Cancel", "cancel", this);
int width = 200;
int height = 150;
setContentSize(width, height);
- userField->setPosition(65, 5);
- userField->setWidth(130);
- passwordField->setPosition(
- 65, userField->getY() + userField->getHeight() + 7);
- passwordField->setWidth(130);
- confirmField->setPosition(
- 65, passwordField->getY() + passwordField->getHeight() + 7);
- confirmField->setWidth(130);
- serverField->setPosition(
- 65, 23 + confirmField->getY() + confirmField->getHeight() + 7);
- serverField->setWidth(130);
-
- userLabel->setPosition(5, userField->getY() + 1);
- passwordLabel->setPosition(5, passwordField->getY() + 1);
- confirmLabel->setPosition(5, confirmField->getY() + 1);
- serverLabel->setPosition(5, serverField->getY() + 1);
+ mUserField->setPosition(65, 5);
+ mUserField->setWidth(130);
+ mPasswordField->setPosition(
+ 65, mUserField->getY() + mUserField->getHeight() + 7);
+ mPasswordField->setWidth(130);
+ mConfirmField->setPosition(
+ 65, mPasswordField->getY() + mPasswordField->getHeight() + 7);
+ mConfirmField->setWidth(130);
+ mServerField->setPosition(
+ 65, 23 + mConfirmField->getY() + mConfirmField->getHeight() + 7);
+ mServerField->setWidth(130);
+
+ userLabel->setPosition(5, mUserField->getY() + 1);
+ passwordLabel->setPosition(5, mPasswordField->getY() + 1);
+ confirmLabel->setPosition(5, mConfirmField->getY() + 1);
+ serverLabel->setPosition(5, mServerField->getY() + 1);
- femaleButton->setPosition(width - femaleButton->getWidth() - 10,
- confirmField->getY() + confirmField->getHeight() + 7);
- maleButton->setPosition(femaleButton->getX() - maleButton->getWidth() - 5,
- femaleButton->getY());
+ mFemaleButton->setPosition(width - mFemaleButton->getWidth() - 10,
+ mConfirmField->getY() + mConfirmField->getHeight() + 7);
+ mMaleButton->setPosition(mFemaleButton->getX() - mMaleButton->getWidth() - 5,
+ mFemaleButton->getY());
- registerButton->setPosition(5, height - registerButton->getHeight() - 5);
- cancelButton->setPosition(10 + registerButton->getWidth(),
- registerButton->getY());
+ mRegisterButton->setPosition(5, height - mRegisterButton->getHeight() - 5);
+ mCancelButton->setPosition(10 + mRegisterButton->getWidth(),
+ mRegisterButton->getY());
- /*userField->setEventId("register");
- passwordField->setEventId("register");
- confirmField->setEventId("register");
- serverField->setEventId("register");*/
+ /*mUserField->setEventId("register");
+ mPasswordField->setEventId("register");
+ mConfirmField->setEventId("register");
+ mServerField->setEventId("register");*/
- /*userField->addActionListener(this);
- passwordField->addActionListener(this);
- confirmField->addActionListener(this);
- serverField->addActionListener(this);*/
+ /*mUserField->addActionListener(this);
+ mPasswordField->addActionListener(this);
+ mConfirmField->addActionListener(this);
+ mServerField->addActionListener(this);*/
add(userLabel);
add(passwordLabel);
add(serverLabel);
add(confirmLabel);
- add(userField);
- add(passwordField);
- add(confirmField);
- add(serverField);
- add(maleButton);
- add(femaleButton);
- add(registerButton);
- add(cancelButton);
+ add(mUserField);
+ add(mPasswordField);
+ add(mConfirmField);
+ add(mServerField);
+ add(mMaleButton);
+ add(mFemaleButton);
+ add(mRegisterButton);
+ add(mCancelButton);
setLocationRelativeTo(getParent());
- userField->requestFocus();
- userField->setCaretPosition(userField->getText().length());
+ mUserField->requestFocus();
+ mUserField->setCaretPosition(mUserField->getText().length());
- serverField->setText(config.getValue("host", ""));
+ mServerField->setText(config.getValue("host", ""));
- wrongDataNoticeListener = NULL;
- wrongRegisterNotice = NULL;
+ mWrongDataNoticeListener = NULL;
+ mWrongRegisterNotice = NULL;
}
void
@@ -132,7 +132,7 @@ RegisterDialog::action(const std::string& eventId)
}
else if (eventId == "register")
{
- const std::string user = userField->getText();
+ const std::string user = mUserField->getText();
logger->log("RegisterDialog::register Username is %s", user.c_str());
std::stringstream errorMsg;
@@ -161,7 +161,7 @@ RegisterDialog::action(const std::string& eventId)
<< " characters long.";
error = 1;
}
- else if (passwordField->getText().length() < LEN_MIN_PASSWORD)
+ else if (mPasswordField->getText().length() < LEN_MIN_PASSWORD)
{
// Pass too short
errorMsg << "The password needs to be at least "
@@ -169,7 +169,7 @@ RegisterDialog::action(const std::string& eventId)
<< " characters long.";
error = 2;
}
- else if (passwordField->getText().length() > LEN_MAX_PASSWORD - 1 )
+ else if (mPasswordField->getText().length() > LEN_MAX_PASSWORD - 1 )
{
// Pass too long
errorMsg << "The password needs to be less than "
@@ -177,7 +177,7 @@ RegisterDialog::action(const std::string& eventId)
<< " characters long.";
error = 2;
}
- else if (passwordField->getText() != confirmField->getText())
+ else if (mPasswordField->getText() != mConfirmField->getText())
{
// Password does not match with the confirmation one
errorMsg << "Passwords do not match.";
@@ -186,36 +186,36 @@ RegisterDialog::action(const std::string& eventId)
if (error > 0)
{
- wrongDataNoticeListener = new WrongDataNoticeListener();
+ mWrongDataNoticeListener = new WrongDataNoticeListener();
if (error == 1)
{
- wrongDataNoticeListener->setTarget(this->userField);
+ mWrongDataNoticeListener->setTarget(this->mUserField);
}
else if (error == 2)
{
- wrongDataNoticeListener->setTarget(this->passwordField);
+ mWrongDataNoticeListener->setTarget(this->mPasswordField);
// Reset password confirmation
- confirmField->setText("");
+ mConfirmField->setText("");
}
- if (wrongRegisterNotice)
+ if (mWrongRegisterNotice)
{
- delete wrongRegisterNotice;
- wrongRegisterNotice = NULL;
+ delete mWrongRegisterNotice;
+ mWrongRegisterNotice = NULL;
}
- wrongRegisterNotice = new OkDialog("Error", errorMsg.str());
- wrongRegisterNotice->addActionListener(wrongDataNoticeListener);
+ mWrongRegisterNotice = new OkDialog("Error", errorMsg.str());
+ mWrongRegisterNotice->addActionListener(mWrongDataNoticeListener);
}
else
{
// No errors detected, register the new user.
- registerButton->setEnabled(false);
+ mRegisterButton->setEnabled(false);
mLoginData->hostname = config.getValue("host", "animesites.de");
mLoginData->port = (short)config.getValue("port", 0);
- mLoginData->username = userField->getText();
- mLoginData->password = passwordField->getText();
- mLoginData->username += femaleButton->isMarked() ? "_F" : "_M";
+ mLoginData->username = mUserField->getText();
+ mLoginData->password = mPasswordField->getText();
+ mLoginData->username += mFemaleButton->isMarked() ? "_F" : "_M";
state = ACCOUNT_STATE;
}
diff --git a/src/gui/register.h b/src/gui/register.h
index 34892ec0..305661f3 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -55,23 +55,20 @@ class RegisterDialog : public Window, public gcn::ActionListener {
// Made them public to have the possibility to request focus
// from external functions.
- gcn::TextField *userField;
- gcn::TextField *passwordField;
- gcn::TextField *confirmField;
private:
- gcn::Label *userLabel;
- gcn::Label *passwordLabel;
- gcn::Label *confirmLabel;
- gcn::Label *serverLabel;
- gcn::TextField *serverField;
- gcn::Button *registerButton;
- gcn::Button *cancelButton;
- gcn::RadioButton *maleButton;
- gcn::RadioButton *femaleButton;
+ gcn::TextField *mUserField;
+ gcn::TextField *mPasswordField;
+ gcn::TextField *mConfirmField;
+ gcn::TextField *mServerField;
- WrongDataNoticeListener *wrongDataNoticeListener;
- OkDialog *wrongRegisterNotice;
+ gcn::Button *mRegisterButton;
+ gcn::Button *mCancelButton;
+ gcn::RadioButton *mMaleButton;
+ gcn::RadioButton *mFemaleButton;
+
+ WrongDataNoticeListener *mWrongDataNoticeListener;
+ OkDialog *mWrongRegisterNotice;
LoginData *mLoginData;
};
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 0ab20660..aa67adab 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -47,65 +47,65 @@
SellDialog::SellDialog(Network *network):
Window("Sell"),
mNetwork(network),
- m_maxItems(0), m_amountItems(0)
+ mMaxItems(0), mAmountItems(0)
{
mShopItems = new ShopItems();
- itemList = new ListBox(mShopItems);
- scrollArea = new ScrollArea(itemList);
- slider = new Slider(1.0);
- quantityLabel = new gcn::Label("0");
- moneyLabel = new gcn::Label("Price: 0");
- itemDescLabel = new gcn::Label("Description:");
- itemEffectLabel = new gcn::Label("Effect:");
- increaseButton = new Button("+", "+", this);
- decreaseButton = new Button("-", "-", this);
- sellButton = new Button("Sell", "sell", this);
- quitButton = new Button("Quit", "quit", this);
- sellButton->setEnabled(false);
+ mItemList = new ListBox(mShopItems);
+ ScrollArea *scrollArea = new ScrollArea(mItemList);
+ mSlider = new Slider(1.0);
+ mQuantityLabel = new gcn::Label("0");
+ mMoneyLabel = new gcn::Label("Price: 0");
+ mItemDescLabel = new gcn::Label("Description:");
+ mItemEffectLabel = new gcn::Label("Effect:");
+ mIncreaseButton = new Button("+", "+", this);
+ mDecreaseButton = new Button("-", "-", this);
+ mSellButton = new Button("Sell", "sell", this);
+ Button *quitButton = new Button("Quit", "quit", this);
+ mSellButton->setEnabled(false);
setContentSize(260, 210);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
- itemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
+ mItemList->setDimension(gcn::Rectangle(5, 5, 238, 110));
- slider->setDimension(gcn::Rectangle(5, 120, 200, 10));
- slider->setEnabled(false);
+ mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10));
+ mSlider->setEnabled(false);
- quantityLabel->setPosition(215, 120);
+ mQuantityLabel->setPosition(215, 120);
- increaseButton->setPosition(40, 186);
- increaseButton->setSize(20, 20);
- increaseButton->setEnabled(false);
+ mIncreaseButton->setPosition(40, 186);
+ mIncreaseButton->setSize(20, 20);
+ mIncreaseButton->setEnabled(false);
- decreaseButton->setPosition(10, 186);
- decreaseButton->setSize(20, 20);
- decreaseButton->setEnabled(false);
+ mDecreaseButton->setPosition(10, 186);
+ mDecreaseButton->setSize(20, 20);
+ mDecreaseButton->setEnabled(false);
- moneyLabel->setPosition(5, 130);
- itemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14));
- itemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14));
+ mMoneyLabel->setPosition(5, 130);
+ mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14));
+ mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14));
- sellButton->setPosition(175, 186);
- sellButton->setEnabled(false);
+ mSellButton->setPosition(175, 186);
+ mSellButton->setEnabled(false);
quitButton->setPosition(208, 186);
- itemList->setEventId("item");
- slider->setEventId("slider");
+ mItemList->setEventId("item");
+ mSlider->setEventId("mSlider");
- itemList->addActionListener(this);
- slider->addActionListener(this);
+ mItemList->addActionListener(this);
+ mSlider->addActionListener(this);
add(scrollArea);
- add(slider);
- add(quantityLabel);
- add(moneyLabel);
- add(itemEffectLabel);
- add(itemDescLabel);
- add(increaseButton);
- add(decreaseButton);
- add(sellButton);
+ add(mSlider);
+ add(mQuantityLabel);
+ add(mMoneyLabel);
+ add(mItemEffectLabel);
+ add(mItemDescLabel);
+ add(mIncreaseButton);
+ add(mDecreaseButton);
+ add(mSellButton);
add(quitButton);
setLocationRelativeTo(getParent());
@@ -119,20 +119,20 @@ SellDialog::~SellDialog()
void SellDialog::reset()
{
mShopItems->clear();
- slider->setValue(0.0);
- m_amountItems = 0;
+ mSlider->setValue(0.0);
+ mAmountItems = 0;
- quantityLabel->setCaption("0");
- quantityLabel->adjustSize();
- moneyLabel->setCaption("Price: 0");
- moneyLabel->adjustSize();
- itemDescLabel->setCaption("");
- itemEffectLabel->setCaption("");
+ mQuantityLabel->setCaption("0");
+ mQuantityLabel->adjustSize();
+ mMoneyLabel->setCaption("Price: 0");
+ mMoneyLabel->adjustSize();
+ mItemDescLabel->setCaption("");
+ mItemEffectLabel->setCaption("");
// Reset Previous Selected Items to prevent failing asserts
- itemList->setSelected(-1);
- increaseButton->setEnabled(false);
- decreaseButton->setEnabled(false);
+ mItemList->setSelected(-1);
+ mIncreaseButton->setEnabled(false);
+ mDecreaseButton->setEnabled(false);
}
void SellDialog::addItem(Item *item, int price)
@@ -152,31 +152,31 @@ void SellDialog::addItem(Item *item, int price)
item_shop.quantity = item->getQuantity();
mShopItems->push_back(item_shop);
- itemList->adjustSize();
+ mItemList->adjustSize();
}
void SellDialog::action(const std::string& eventId)
{
- int selectedItem = itemList->getSelected();
+ int selectedItem = mItemList->getSelected();
if (eventId == "item") {
- m_amountItems = 0;
- slider->setValue(0);
- decreaseButton->setEnabled(false);
- sellButton->setEnabled(false);
+ mAmountItems = 0;
+ mSlider->setValue(0);
+ mDecreaseButton->setEnabled(false);
+ mSellButton->setEnabled(false);
- quantityLabel->setCaption("0");
- quantityLabel->adjustSize();
- moneyLabel->setCaption("Price: 0");
- moneyLabel->adjustSize();
+ mQuantityLabel->setCaption("0");
+ mQuantityLabel->adjustSize();
+ mMoneyLabel->setCaption("Price: 0");
+ mMoneyLabel->adjustSize();
if (selectedItem > -1) {
- slider->setEnabled(true);
- increaseButton->setEnabled(true);
- m_maxItems = mShopItems->at(selectedItem).quantity;
+ mSlider->setEnabled(true);
+ mIncreaseButton->setEnabled(true);
+ mMaxItems = mShopItems->at(selectedItem).quantity;
} else {
- slider->setEnabled(false);
- increaseButton->setEnabled(false);
+ mSlider->setEnabled(false);
+ mIncreaseButton->setEnabled(false);
}
}
else if (eventId == "quit")
@@ -192,50 +192,50 @@ void SellDialog::action(const std::string& eventId)
bool updateButtonsAndLabels = false;
- if (eventId == "slider") {
- m_amountItems = (int)(slider->getValue() * m_maxItems);
+ if (eventId == "mSlider") {
+ mAmountItems = (int)(mSlider->getValue() * mMaxItems);
updateButtonsAndLabels = true;
}
else if (eventId == "+") {
- assert(m_amountItems < m_maxItems);
- m_amountItems++;
- slider->setValue(double(m_amountItems)/double(m_maxItems));
+ assert(mAmountItems < mMaxItems);
+ mAmountItems++;
+ mSlider->setValue(double(mAmountItems)/double(mMaxItems));
updateButtonsAndLabels = true;
}
else if (eventId == "-") {
- assert(m_amountItems > 0);
- m_amountItems--;
+ assert(mAmountItems > 0);
+ mAmountItems--;
- slider->setValue(double(m_amountItems)/double(m_maxItems));
+ mSlider->setValue(double(mAmountItems)/double(mMaxItems));
updateButtonsAndLabels = true;
}
else if (eventId == "sell") {
// Attempt sell
- assert(m_amountItems > 0 && m_amountItems <= m_maxItems);
+ assert(mAmountItems > 0 && mAmountItems <= mMaxItems);
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_SELL_REQUEST);
outMsg.writeInt16(8);
outMsg.writeInt16(mShopItems->at(selectedItem).index);
- outMsg.writeInt16(m_amountItems);
+ outMsg.writeInt16(mAmountItems);
- m_maxItems -= m_amountItems;
- m_amountItems = 0;
- slider->setValue(0);
- slider->setEnabled(m_maxItems != 0);
+ mMaxItems -= mAmountItems;
+ mAmountItems = 0;
+ mSlider->setValue(0);
+ mSlider->setEnabled(mMaxItems != 0);
// All were sold
- if (!m_maxItems) {
- itemList->setSelected(-1);
+ if (!mMaxItems) {
+ mItemList->setSelected(-1);
mShopItems->erase(mShopItems->begin() + selectedItem);
}
// Update only when there are items left, the entry doesn't exist
// otherwise and can't be updated
- updateButtonsAndLabels = bool(m_maxItems);
+ updateButtonsAndLabels = bool(mMaxItems);
}
// If anything changed, we need to update the buttons and labels
@@ -243,18 +243,18 @@ void SellDialog::action(const std::string& eventId)
std::stringstream oss;
// Update labels
- oss << m_amountItems;
- quantityLabel->setCaption(oss.str());
- quantityLabel->adjustSize();
+ oss << mAmountItems;
+ mQuantityLabel->setCaption(oss.str());
+ mQuantityLabel->adjustSize();
oss.str("");
- oss << "Price: " << m_amountItems * mShopItems->at(selectedItem).price;
- moneyLabel->setCaption(oss.str());
- moneyLabel->adjustSize();
+ oss << "Price: " << mAmountItems * mShopItems->at(selectedItem).price;
+ mMoneyLabel->setCaption(oss.str());
+ mMoneyLabel->adjustSize();
// Update Buttons
- sellButton->setEnabled(m_amountItems > 0);
- decreaseButton->setEnabled(m_amountItems > 0);
- increaseButton->setEnabled(m_amountItems < m_maxItems);
+ mSellButton->setEnabled(mAmountItems > 0);
+ mDecreaseButton->setEnabled(mAmountItems > 0);
+ mIncreaseButton->setEnabled(mAmountItems < mMaxItems);
}
}
@@ -262,12 +262,12 @@ void SellDialog::mouseClick(int x, int y, int button, int count)
{
Window::mouseClick(x, y, button, count);
- int selectedItem = itemList->getSelected();
+ int selectedItem = mItemList->getSelected();
if (selectedItem > -1)
{
- itemDescLabel->setCaption("Description: " +
+ mItemDescLabel->setCaption("Description: " +
itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getDescription());
- itemEffectLabel->setCaption("Effect: " +
+ mItemEffectLabel->setCaption("Effect: " +
itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getEffect());
}
}
diff --git a/src/gui/sell.h b/src/gui/sell.h
index 86caff55..59bc58c2 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -77,22 +77,20 @@ class SellDialog : public Window, public gcn::ActionListener
private:
Network *mNetwork;
- gcn::Button *sellButton;
- gcn::Button *quitButton;
- gcn::Button *increaseButton;
- gcn::Button *decreaseButton;
- gcn::ListBox *itemList;
- gcn::ScrollArea *scrollArea;
- gcn::Label *moneyLabel;
- gcn::Label *itemDescLabel;
- gcn::Label *itemEffectLabel;
- gcn::Label *quantityLabel;
- gcn::Slider *slider;
+ gcn::Button *mSellButton;
+ gcn::Button *mIncreaseButton;
+ gcn::Button *mDecreaseButton;
+ gcn::ListBox *mItemList;
+ gcn::Label *mMoneyLabel;
+ gcn::Label *mItemDescLabel;
+ gcn::Label *mItemEffectLabel;
+ gcn::Label *mQuantityLabel;
+ gcn::Slider *mSlider;
ShopItems *mShopItems;
- int m_maxItems;
- int m_amountItems;
+ int mMaxItems;
+ int mAmountItems;
};
#endif
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index dade13eb..f680d6ac 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -55,6 +55,38 @@ extern Window *equipmentWindow;
extern Window *helpWindow;
extern Window *skillDialog;
+/**
+ * The list model for mode list.
+ *
+ * \ingroup Interface
+ */
+class ModeListModel : public gcn::ListModel
+{
+ public:
+ /**
+ * Constructor.
+ */
+ ModeListModel();
+
+ /**
+ * Destructor.
+ */
+ virtual ~ModeListModel() { }
+
+ /**
+ * Returns the number of elements in container.
+ */
+ int getNumberOfElements() { return mVideoModes.size(); }
+
+ /**
+ * Returns element from container.
+ */
+ std::string getElementAt(int i) { return mVideoModes[i]; }
+
+ private:
+ std::vector<std::string> mVideoModes;
+};
+
ModeListModel::ModeListModel()
{
SDL_Rect **modes;
@@ -78,57 +110,42 @@ ModeListModel::ModeListModel()
//logger->log(" %dx%d", modes[i]->w, modes[i]->h);
std::stringstream mode;
mode << (int)modes[i]->w << "x" << (int)modes[i]->h;
- videoModes.push_back(mode.str());
+ mVideoModes.push_back(mode.str());
}
}
}
-ModeListModel::~ModeListModel()
-{
-}
-
-int ModeListModel::getNumberOfElements()
-{
- return videoModes.size();
-}
-
-std::string ModeListModel::getElementAt(int i)
-{
- return videoModes[i];
-}
-
-
Setup::Setup():
Window("Setup")
{
- modeListModel = new ModeListModel();
- modeList = new ListBox(modeListModel);
- modeList->setEnabled(false);
- scrollArea = new ScrollArea(modeList);
- fsCheckBox = new CheckBox("Full screen", false);
- openGLCheckBox = new CheckBox("OpenGL", false);
+ mModeListModel = new ModeListModel();
+ mModeList = new ListBox(mModeListModel);
+ mModeList->setEnabled(false);
+ ScrollArea *scrollArea = new ScrollArea(mModeList);
+ mFsCheckBox = new CheckBox("Full screen", false);
+ mOpenGLCheckBox = new CheckBox("OpenGL", false);
#ifndef USE_OPENGL
- openGLCheckBox->setEnabled(false);
+ mOpenGLCheckBox->setEnabled(false);
#endif
- customCursorCheckBox = new CheckBox("Custom cursor");
- alphaLabel = new gcn::Label("Gui opacity");
- alphaSlider = new Slider(0.2, 1.0);
- soundCheckBox = new CheckBox("Sound", false);
- sfxSlider = new Slider(0, 128);
- musicSlider = new Slider(0, 128);
- sfxLabel = new gcn::Label("Sfx volume");
- musicLabel = new gcn::Label("Music volume");
- calibrateLabel = new gcn::Label("Press the button to start calibration");
- calibrateButton = new Button("Calibrate", "calibrate", this);
- applyButton = new Button("Apply", "apply", this);
- cancelButton = new Button("Cancel", "cancel", this);
- resetWinsToDefault = new Button("Reset Windows", "winsToDefault", this);
+ mCustomCursorCheckBox = new CheckBox("Custom cursor");
+ gcn::Label *alphaLabel = new gcn::Label("Gui opacity");
+ mAlphaSlider = new Slider(0.2, 1.0);
+ mSoundCheckBox = new CheckBox("Sound", false);
+ mSfxSlider = new Slider(0, 128);
+ mMusicSlider = new Slider(0, 128);
+ gcn::Label *sfxLabel = new gcn::Label("Sfx volume");
+ gcn::Label *musicLabel = new gcn::Label("Music volume");
+ mCalibrateLabel = new gcn::Label("Press the button to start calibration");
+ mCalibrateButton = new Button("Calibrate", "calibrate", this);
+ Button *applyButton = new Button("Apply", "apply", this);
+ Button *cancelButton = new Button("Cancel", "cancel", this);
+ Button *resetWinsToDefault = new Button("Reset Windows", "winsToDefault", this);
// Set events
- alphaSlider->setEventId("guialpha");
- sfxSlider->setEventId("sfx");
- musicSlider->setEventId("music");
- customCursorCheckBox->setEventId("customcursor");
+ mAlphaSlider->setEventId("guialpha");
+ mSfxSlider->setEventId("sfx");
+ mMusicSlider->setEventId("music");
+ mCustomCursorCheckBox->setEventId("customcursor");
// Set dimensions/positions
int width = 230;
@@ -136,21 +153,21 @@ Setup::Setup():
setContentSize(width, height);
scrollArea->setDimension(gcn::Rectangle(10, 10, 90, 50));
- modeList->setDimension(gcn::Rectangle(0, 0, 60, 50));
- fsCheckBox->setPosition(110, 10);
- openGLCheckBox->setPosition(110, 30);
- customCursorCheckBox->setPosition(110, 50);
- alphaSlider->setDimension(gcn::Rectangle(10, 80, 100, 10));
- alphaLabel->setPosition(20 + alphaSlider->getWidth(), alphaSlider->getY());
-
- soundCheckBox->setPosition(10, 10);
- sfxSlider->setDimension(gcn::Rectangle(10, 30, 100, 10));
- musicSlider->setDimension(gcn::Rectangle(10, 50, 100, 10));
- sfxLabel->setPosition(20 + sfxSlider->getWidth(), 27);
- musicLabel->setPosition(20 + musicSlider->getWidth(), 47);
+ mModeList->setDimension(gcn::Rectangle(0, 0, 60, 50));
+ mFsCheckBox->setPosition(110, 10);
+ mOpenGLCheckBox->setPosition(110, 30);
+ mCustomCursorCheckBox->setPosition(110, 50);
+ mAlphaSlider->setDimension(gcn::Rectangle(10, 80, 100, 10));
+ alphaLabel->setPosition(20 + mAlphaSlider->getWidth(), mAlphaSlider->getY());
+
+ mSoundCheckBox->setPosition(10, 10);
+ mSfxSlider->setDimension(gcn::Rectangle(10, 30, 100, 10));
+ mMusicSlider->setDimension(gcn::Rectangle(10, 50, 100, 10));
+ sfxLabel->setPosition(20 + mSfxSlider->getWidth(), 27);
+ musicLabel->setPosition(20 + mMusicSlider->getWidth(), 47);
- calibrateLabel->setPosition(5, 10);
- calibrateButton->setPosition(10, 20 + calibrateLabel->getHeight());
+ mCalibrateLabel->setPosition(5, 10);
+ mCalibrateButton->setPosition(10, 20 + mCalibrateLabel->getHeight());
cancelButton->setPosition(
width - cancelButton->getWidth() - 5,
@@ -163,33 +180,33 @@ Setup::Setup():
applyButton->getY());
// Listen for actions
- alphaSlider->addActionListener(this);
- sfxSlider->addActionListener(this);
- musicSlider->addActionListener(this);
- customCursorCheckBox->addActionListener(this);
+ mAlphaSlider->addActionListener(this);
+ mSfxSlider->addActionListener(this);
+ mMusicSlider->addActionListener(this);
+ mCustomCursorCheckBox->addActionListener(this);
// Assemble dialog
gcn::Container *video = new gcn::Container();
video->setOpaque(false);
video->add(scrollArea);
- video->add(fsCheckBox);
- video->add(openGLCheckBox);
- video->add(customCursorCheckBox);
- video->add(alphaSlider);
+ video->add(mFsCheckBox);
+ video->add(mOpenGLCheckBox);
+ video->add(mCustomCursorCheckBox);
+ video->add(mAlphaSlider);
video->add(alphaLabel);
gcn::Container *audio = new gcn::Container();
audio->setOpaque(false);
- audio->add(soundCheckBox);
- audio->add(sfxSlider);
- audio->add(musicSlider);
+ audio->add(mSoundCheckBox);
+ audio->add(mSfxSlider);
+ audio->add(mMusicSlider);
audio->add(sfxLabel);
audio->add(musicLabel);
gcn::Container *input = new gcn::Container();
input->setOpaque(false);
- input->add(calibrateLabel);
- input->add(calibrateButton);
+ input->add(mCalibrateLabel);
+ input->add(mCalibrateButton);
TabbedContainer *panel = new TabbedContainer();
panel->setDimension(gcn::Rectangle(5, 5, 220, 130));
@@ -205,71 +222,71 @@ Setup::Setup():
setLocationRelativeTo(getParent());
// Load default settings
- modeList->setSelected(-1);
+ mModeList->setSelected(-1);
// Full Screen
- fullScreenEnabled = config.getValue("screen", 0);
- fsCheckBox->setMarked(fullScreenEnabled);
+ mFullScreenEnabled = config.getValue("screen", 0);
+ mFsCheckBox->setMarked(mFullScreenEnabled);
// Sound
- soundEnabled = config.getValue("sound", 0);
- soundCheckBox->setMarked(soundEnabled);
+ mSoundEnabled = config.getValue("sound", 0);
+ mSoundCheckBox->setMarked(mSoundEnabled);
- sfxVolume = (int)config.getValue("sfxVolume", 100);
- sfxSlider->setValue(sfxVolume);
+ mSfxVolume = (int)config.getValue("sfxVolume", 100);
+ mSfxSlider->setValue(mSfxVolume);
- musicVolume = (int)config.getValue("musicVolume", 60);
- musicSlider->setValue(musicVolume);
+ mMusicVolume = (int)config.getValue("musicVolume", 60);
+ mMusicSlider->setValue(mMusicVolume);
// Graphics
- customCursorEnabled = config.getValue("customcursor", 1);
- customCursorCheckBox->setMarked(customCursorEnabled);
+ mCustomCursorEnabled = config.getValue("customcursor", 1);
+ mCustomCursorCheckBox->setMarked(mCustomCursorEnabled);
- opacity = config.getValue("guialpha", 0.8);
- alphaSlider->setValue(opacity);
+ mOpacity = config.getValue("guialpha", 0.8);
+ mAlphaSlider->setValue(mOpacity);
- openGLEnabled = config.getValue("opengl", 0);
- openGLCheckBox->setMarked(openGLEnabled);
+ mOpenGLEnabled = config.getValue("opengl", 0);
+ mOpenGLCheckBox->setMarked(mOpenGLEnabled);
}
Setup::~Setup()
{
- delete modeListModel;
+ delete mModeListModel;
}
void Setup::action(const std::string &eventId)
{
if (eventId == "sfx")
{
- config.setValue("sfxVolume", (int)sfxSlider->getValue());
- sound.setSfxVolume((int)sfxSlider->getValue());
+ config.setValue("sfxVolume", (int)mSfxSlider->getValue());
+ sound.setSfxVolume((int)mSfxSlider->getValue());
}
else if (eventId == "music")
{
- config.setValue("musicVolume", (int)musicSlider->getValue());
- sound.setMusicVolume((int)musicSlider->getValue());
+ config.setValue("musicVolume", (int)mMusicSlider->getValue());
+ sound.setMusicVolume((int)mMusicSlider->getValue());
}
else if (eventId == "guialpha")
{
- config.setValue("guialpha", alphaSlider->getValue());
+ config.setValue("guialpha", mAlphaSlider->getValue());
}
else if (eventId == "customcursor")
{
config.setValue("customcursor",
- customCursorCheckBox->isMarked() ? 1 : 0);
+ mCustomCursorCheckBox->isMarked() ? 1 : 0);
}
else if (eventId == "calibrate" && joystick != NULL)
{
if (joystick->isCalibrating())
{
- calibrateButton->setCaption("Calibrate");
- calibrateLabel->setCaption("Press the button to start calibration");
+ mCalibrateButton->setCaption("Calibrate");
+ mCalibrateLabel->setCaption("Press the button to start calibration");
joystick->finishCalibration();
}
else
{
- calibrateButton->setCaption("Stop");
- calibrateLabel->setCaption("Rotate the stick");
+ mCalibrateButton->setCaption("Stop");
+ mCalibrateLabel->setCaption("Rotate the stick");
joystick->startCalibration();
}
}
@@ -278,7 +295,7 @@ void Setup::action(const std::string &eventId)
setVisible(false);
// Full screen changes
- bool fullscreen = fsCheckBox->isMarked();
+ bool fullscreen = mFsCheckBox->isMarked();
if (fullscreen != (config.getValue("screen", 0) == 1))
{
// checks for opengl usage
@@ -305,7 +322,7 @@ void Setup::action(const std::string &eventId)
}
// Sound settings changes
- if (soundCheckBox->isMarked())
+ if (mSoundCheckBox->isMarked())
{
config.setValue("sound", 1);
try {
@@ -324,9 +341,9 @@ void Setup::action(const std::string &eventId)
}
// OpenGL change
- if (openGLCheckBox->isMarked() != openGLEnabled)
+ if (mOpenGLCheckBox->isMarked() != mOpenGLEnabled)
{
- config.setValue("opengl", openGLCheckBox->isMarked() ? 1 : 0);
+ config.setValue("opengl", mOpenGLCheckBox->isMarked() ? 1 : 0);
// OpenGL can currently only be changed by restarting, notify user.
new OkDialog("Changing OpenGL",
@@ -335,17 +352,17 @@ void Setup::action(const std::string &eventId)
// We sync old and new values at apply time
// Screen
- fullScreenEnabled = config.getValue("screen", 0);
+ mFullScreenEnabled = config.getValue("screen", 0);
// Sound
- soundEnabled = config.getValue("sound", 0);
- sfxVolume = (int)config.getValue("sfxVolume", 100);
- musicVolume = (int)config.getValue("musicVolume", 60);
+ mSoundEnabled = config.getValue("sound", 0);
+ mSfxVolume = (int)config.getValue("sfxVolume", 100);
+ mMusicVolume = (int)config.getValue("musicVolume", 60);
// Graphics
- customCursorEnabled = config.getValue("customcursor", 1);
- opacity = config.getValue("guialpha", 0.8);
- openGLEnabled = config.getValue("opengl", 0);
+ mCustomCursorEnabled = config.getValue("customcursor", 1);
+ mOpacity = config.getValue("guialpha", 0.8);
+ mOpenGLEnabled = config.getValue("opengl", 0);
}
else if (eventId == "cancel")
{
@@ -353,30 +370,30 @@ void Setup::action(const std::string &eventId)
// Restoring old values when cancelling
// Screen
- config.setValue("screen", fullScreenEnabled ? 1 : 0);
- fsCheckBox->setMarked(fullScreenEnabled);
+ config.setValue("screen", mFullScreenEnabled ? 1 : 0);
+ mFsCheckBox->setMarked(mFullScreenEnabled);
// Sound
- config.getValue("sound", soundEnabled ? 1 : 0);
- soundCheckBox->setMarked(soundEnabled);
+ config.getValue("sound", mSoundEnabled ? 1 : 0);
+ mSoundCheckBox->setMarked(mSoundEnabled);
- config.getValue("sfxVolume", sfxVolume ? 1 : 0);
- sound.setSfxVolume(sfxVolume);
- sfxSlider->setValue(sfxVolume);
+ config.getValue("sfxVolume", mSfxVolume ? 1 : 0);
+ sound.setSfxVolume(mSfxVolume);
+ mSfxSlider->setValue(mSfxVolume);
- config.setValue("musicVolume", musicVolume);
- sound.setMusicVolume(musicVolume);
- musicSlider->setValue(musicVolume);
+ config.setValue("musicVolume", mMusicVolume);
+ sound.setMusicVolume(mMusicVolume);
+ mMusicSlider->setValue(mMusicVolume);
// Graphics
- config.setValue("customcursor", customCursorEnabled ? 1 : 0);
- customCursorCheckBox->setMarked(customCursorEnabled);
+ config.setValue("customcursor", mCustomCursorEnabled ? 1 : 0);
+ mCustomCursorCheckBox->setMarked(mCustomCursorEnabled);
- config.setValue("guialpha", opacity);
- alphaSlider->setValue(opacity);
+ config.setValue("guialpha", mOpacity);
+ mAlphaSlider->setValue(mOpacity);
- config.setValue("opengl", openGLEnabled ? 1 : 0);
- openGLCheckBox->setMarked(openGLEnabled);
+ config.setValue("opengl", mOpenGLEnabled ? 1 : 0);
+ mOpenGLCheckBox->setMarked(mOpenGLEnabled);
}
else if (eventId == "winsToDefault")
{
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 91f181d5..fa870489 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -34,38 +34,6 @@
#include "../guichanfwd.h"
/**
- * The list model for mode list.
- *
- * \ingroup Interface
- */
-class ModeListModel : public gcn::ListModel
-{
- public:
- /**
- * Constructor.
- */
- ModeListModel();
-
- /**
- * Destructor.
- */
- virtual ~ModeListModel();
-
- /**
- * Returns the number of elements in container.
- */
- int getNumberOfElements();
-
- /**
- * Returns element from container.
- */
- std::string getElementAt(int i);
-
- private:
- std::vector<std::string> videoModes;
-};
-
-/**
* The setup dialog.
*
* \ingroup GUI
@@ -90,31 +58,26 @@ class Setup : public Window, public gcn::ActionListener
action(const std::string& eventId);
private:
- ModeListModel *modeListModel;
+ class ModeListModel *mModeListModel;
// Dialog widgets
- gcn::ListBox *modeList;
- gcn::ScrollArea *scrollArea;
- gcn::Label *alphaLabel;
- gcn::Label *sfxLabel, *musicLabel;
- gcn::Label *calibrateLabel;
- gcn::CheckBox *fsCheckBox;
- gcn::CheckBox *openGLCheckBox;
- gcn::CheckBox *soundCheckBox;
- gcn::CheckBox *customCursorCheckBox;
- gcn::Slider *alphaSlider;
- gcn::Slider *sfxSlider, *musicSlider;
- gcn::Button *calibrateButton;
- gcn::Button *applyButton, *cancelButton;
- gcn::Button *resetWinsToDefault;
+ gcn::ListBox *mModeList;
+ gcn::CheckBox *mFsCheckBox;
+ gcn::CheckBox *mOpenGLCheckBox;
+ gcn::CheckBox *mSoundCheckBox;
+ gcn::CheckBox *mCustomCursorCheckBox;
+ gcn::Slider *mAlphaSlider;
+ gcn::Slider *mSfxSlider, *mMusicSlider;
+ gcn::Label *mCalibrateLabel;
+ gcn::Button *mCalibrateButton;
// Variables that keeps old settings until the user "apply" them...
- int musicVolume, sfxVolume;
- double opacity;
- bool fullScreenEnabled;
- bool openGLEnabled;
- bool customCursorEnabled;
- bool soundEnabled;
+ int mMusicVolume, mSfxVolume;
+ double mOpacity;
+ bool mFullScreenEnabled;
+ bool mOpenGLEnabled;
+ bool mCustomCursorEnabled;
+ bool mSoundEnabled;
};
#endif
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 44cbd314..0af8511b 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -68,33 +68,33 @@ SkillDialog::SkillDialog():
setWindowName("Skills");
setDefaultSize(graphics->getWidth() - 255, 25, 240, 240);
- skillListBox = new ListBox(this);
- skillScrollArea = new ScrollArea(skillListBox);
- pointsLabel = new gcn::Label("Skill Points:");
- incButton = new Button("Up", "inc", this);
- useButton = new Button("Use", "use", this);
- useButton->setEnabled(false);
- closeButton = new Button("Close", "close", this);
+ mSkillListBox = new ListBox(this);
+ ScrollArea *skillScrollArea = new ScrollArea(mSkillListBox);
+ mPointsLabel = new gcn::Label("Skill Points:");
+ mIncButton = new Button("Up", "inc", this);
+ mUseButton = new Button("Use", "use", this);
+ mUseButton->setEnabled(false);
+ mCloseButton = new Button("Close", "close", this);
- skillListBox->setEventId("skill");
+ mSkillListBox->setEventId("skill");
skillScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
skillScrollArea->setDimension(gcn::Rectangle(5, 5, 230, 180));
- pointsLabel->setDimension(gcn::Rectangle(8, 190, 200, 16));
- incButton->setPosition(skillScrollArea->getX(), 210);
- useButton->setPosition(incButton->getX() + incButton->getWidth() + 5,
+ mPointsLabel->setDimension(gcn::Rectangle(8, 190, 200, 16));
+ mIncButton->setPosition(skillScrollArea->getX(), 210);
+ mUseButton->setPosition(mIncButton->getX() + mIncButton->getWidth() + 5,
210);
- closeButton->setPosition(
- skillScrollArea->getX() + skillScrollArea->getWidth() - closeButton->getWidth(),
+ mCloseButton->setPosition(
+ skillScrollArea->getX() + skillScrollArea->getWidth() - mCloseButton->getWidth(),
210);
add(skillScrollArea);
- add(pointsLabel);
- add(incButton);
- add(useButton);
- add(closeButton);
+ add(mPointsLabel);
+ add(mIncButton);
+ add(mUseButton);
+ add(mCloseButton);
- skillListBox->addActionListener(this);
+ mSkillListBox->addActionListener(this);
setLocationRelativeTo(getParent());
loadWindowState();
@@ -110,17 +110,17 @@ void SkillDialog::action(const std::string& eventId)
if (eventId == "inc")
{
// Increment skill
- int selectedSkill = skillListBox->getSelected();
+ int selectedSkill = mSkillListBox->getSelected();
if (selectedSkill >= 0)
{
- player_node->raiseSkill(skillList[selectedSkill]->id);
+ player_node->raiseSkill(mSkillList[selectedSkill]->id);
}
}
else if (eventId == "skill")
{
- incButton->setEnabled(
- skillListBox->getSelected() > -1 &&
- player_node->skillPoint > 0);
+ mIncButton->setEnabled(
+ mSkillListBox->getSelected() > -1 &&
+ player_node->mSkillPoint > 0);
}
else if (eventId == "close")
{
@@ -130,29 +130,30 @@ void SkillDialog::action(const std::string& eventId)
void SkillDialog::update()
{
- if (pointsLabel != NULL) {
+ if (mPointsLabel != NULL) {
char tmp[128];
- sprintf(tmp, "Skill points: %i", player_node->skillPoint);
- pointsLabel->setCaption(tmp);
+ sprintf(tmp, "Skill points: %i", player_node->mSkillPoint);
+ mPointsLabel->setCaption(tmp);
}
- incButton->setEnabled(skillListBox->getSelected() > -1 && player_node->skillPoint > 0);
+ mIncButton->setEnabled(mSkillListBox->getSelected() > -1 &&
+ player_node->mSkillPoint > 0);
}
int SkillDialog::getNumberOfElements()
{
- return skillList.size();
+ return mSkillList.size();
}
std::string SkillDialog::getElementAt(int i)
{
- if (i >= 0 && i < (int)skillList.size())
+ if (i >= 0 && i < (int)mSkillList.size())
{
char tmp[128];
sprintf(tmp, "%s Lv: %i Sp: %i",
- skill_db[skillList[i]->id],
- skillList[i]->lv,
- skillList[i]->sp);
+ skill_db[mSkillList[i]->id],
+ mSkillList[i]->lv,
+ mSkillList[i]->sp);
return tmp;
}
return "";
@@ -160,8 +161,8 @@ std::string SkillDialog::getElementAt(int i)
bool SkillDialog::hasSkill(int id)
{
- for (unsigned int i = 0; i < skillList.size(); i++) {
- if (skillList[i]->id == id) {
+ for (unsigned int i = 0; i < mSkillList.size(); i++) {
+ if (mSkillList[i]->id == id) {
return true;
}
}
@@ -174,21 +175,21 @@ void SkillDialog::addSkill(int id, int lvl, int mp)
tmp->id = id;
tmp->lv = lvl;
tmp->sp = mp;
- skillList.push_back(tmp);
+ mSkillList.push_back(tmp);
}
void SkillDialog::setSkill(int id, int lvl, int mp)
{
- for (unsigned int i = 0; i < skillList.size(); i++) {
- if (skillList[i]->id == id) {
- skillList[i]->lv = lvl;
- skillList[i]->sp = mp;
+ for (unsigned int i = 0; i < mSkillList.size(); i++) {
+ if (mSkillList[i]->id == id) {
+ mSkillList[i]->lv = lvl;
+ mSkillList[i]->sp = mp;
}
}
}
void SkillDialog::cleanList()
{
- for_each(skillList.begin(), skillList.end(), make_dtor(skillList));
- skillList.clear();
+ for_each(mSkillList.begin(), mSkillList.end(), make_dtor(mSkillList));
+ mSkillList.clear();
}
diff --git a/src/gui/skill.h b/src/gui/skill.h
index 98a21438..fe80347d 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -70,14 +70,13 @@ class SkillDialog : public Window, public gcn::ActionListener,
void cleanList();
private:
- gcn::ListBox *skillListBox;
- gcn::ScrollArea *skillScrollArea;
- gcn::Label *pointsLabel;
- gcn::Button *incButton;
- gcn::Button *useButton;
- gcn::Button *closeButton;
-
- std::vector<SKILL*> skillList;
+ gcn::ListBox *mSkillListBox;
+ gcn::Label *mPointsLabel;
+ gcn::Button *mIncButton;
+ gcn::Button *mUseButton;
+ gcn::Button *mCloseButton;
+
+ std::vector<SKILL*> mSkillList;
};
extern SkillDialog *skillDialog;
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 1a300fd1..18bde30c 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -49,162 +49,162 @@ StatusWindow::StatusWindow(LocalPlayer *player):
// Status Part
// ----------------------
- lvlLabel = new gcn::Label("Level:");
- gpLabel = new gcn::Label("Money:");
- hpLabel = new gcn::Label("HP:");
- hpValueLabel = new gcn::Label("");
- mpLabel = new gcn::Label("MP:");
- mpValueLabel = new gcn::Label("");
- xpLabel = new gcn::Label("Exp:");
- xpValueLabel = new gcn::Label("");
- jobXpLabel = new gcn::Label("Job:");
- jobValueLabel = new gcn::Label("");
-
- lvlLabel->setPosition(5, 3);
- gpLabel->setPosition(lvlLabel->getX() + lvlLabel->getWidth() + 40, 3);
- hpLabel->setPosition(5, lvlLabel->getY() + lvlLabel->getHeight() + 5);
- hpBar = new ProgressBar(1.0f,
- hpLabel->getX() + hpLabel->getWidth() + 5,
- hpLabel->getY(), 80, 15, 0, 171, 34);
- hpValueLabel->setPosition(hpBar->getX() + hpBar->getWidth() + 5,
- hpBar->getY());
- mpLabel->setPosition(5, hpLabel->getY() + hpLabel->getHeight() + 5);
- mpBar = new ProgressBar(1.0f,
- hpBar->getX(),
- mpLabel->getY(), 80, 15, 26, 102, 230);
- mpValueLabel->setPosition(hpValueLabel->getX(), mpBar->getY());
-
- xpLabel->setPosition(175, hpLabel->getY());
- xpBar = new ProgressBar(1.0f, 205, xpLabel->getY(), 80, 15,
+ mLvlLabel = new gcn::Label("Level:");
+ mGpLabel = new gcn::Label("Money:");
+ mHpLabel = new gcn::Label("HP:");
+ mHpValueLabel = new gcn::Label("");
+ mMpLabel = new gcn::Label("MP:");
+ mMpValueLabel = new gcn::Label("");
+ mXpLabel = new gcn::Label("Exp:");
+ mXpValueLabel = new gcn::Label("");
+ mJobXpLabel = new gcn::Label("Job:");
+ mJobValueLabel = new gcn::Label("");
+
+ mLvlLabel->setPosition(5, 3);
+ mGpLabel->setPosition(mLvlLabel->getX() + mLvlLabel->getWidth() + 40, 3);
+ mHpLabel->setPosition(5, mLvlLabel->getY() + mLvlLabel->getHeight() + 5);
+ mHpBar = new ProgressBar(1.0f,
+ mHpLabel->getX() + mHpLabel->getWidth() + 5,
+ mHpLabel->getY(), 80, 15, 0, 171, 34);
+ mHpValueLabel->setPosition(mHpBar->getX() + mHpBar->getWidth() + 5,
+ mHpBar->getY());
+ mMpLabel->setPosition(5, mHpLabel->getY() + mHpLabel->getHeight() + 5);
+ mMpBar = new ProgressBar(1.0f,
+ mHpBar->getX(),
+ mMpLabel->getY(), 80, 15, 26, 102, 230);
+ mMpValueLabel->setPosition(mHpValueLabel->getX(), mMpBar->getY());
+
+ mXpLabel->setPosition(175, mHpLabel->getY());
+ mXpBar = new ProgressBar(1.0f, 205, mXpLabel->getY(), 80, 15,
143, 192, 211);
- xpValueLabel->setPosition(290, xpBar->getY());
- jobXpLabel->setPosition(175, mpLabel->getY());
- jobXpBar = new ProgressBar(1.0f,
- xpBar->getX() + xpBar->getWidth() - 60,
- jobXpLabel->getY(),
+ mXpValueLabel->setPosition(290, mXpBar->getY());
+ mJobXpLabel->setPosition(175, mMpLabel->getY());
+ mJobXpBar = new ProgressBar(1.0f,
+ mXpBar->getX() + mXpBar->getWidth() - 60,
+ mJobXpLabel->getY(),
60, 15,
220, 135, 203);
- jobValueLabel->setPosition(290, jobXpBar->getY());
-
- add(lvlLabel);
- add(gpLabel);
- add(hpLabel);
- add(hpValueLabel);
- add(mpLabel);
- add(mpValueLabel);
- add(xpLabel);
- add(xpValueLabel);
- add(jobXpLabel);
- add(jobValueLabel);
- add(hpBar);
- add(mpBar);
- add(xpBar);
- add(jobXpBar);
+ mJobValueLabel->setPosition(290, mJobXpBar->getY());
+
+ add(mLvlLabel);
+ add(mGpLabel);
+ add(mHpLabel);
+ add(mHpValueLabel);
+ add(mMpLabel);
+ add(mMpValueLabel);
+ add(mXpLabel);
+ add(mXpValueLabel);
+ add(mJobXpLabel);
+ add(mJobValueLabel);
+ add(mHpBar);
+ add(mMpBar);
+ add(mXpBar);
+ add(mJobXpBar);
// ----------------------
// Stats Part
// ----------------------
// Static Labels
- statsTitleLabel = new gcn::Label("Stats");
- statsTotalLabel = new gcn::Label("Total");
- statsCostLabel = new gcn::Label("Cost");
+ gcn::Label *mStatsTitleLabel = new gcn::Label("Stats");
+ gcn::Label *mStatsTotalLabel = new gcn::Label("Total");
+ gcn::Label *mStatsCostLabel = new gcn::Label("Cost");
// Derived Stats
- statsAttackLabel = new gcn::Label("Attack:");
- statsDefenseLabel= new gcn::Label("Defense:");
- statsMagicAttackLabel = new gcn::Label("M.Attack:");
- statsMagicDefenseLabel = new gcn::Label("M.Defense:");
- statsAccuracyLabel = new gcn::Label("% Accuracy:");
- statsEvadeLabel = new gcn::Label("% Evade:");
- statsReflexLabel = new gcn::Label("% Reflex:");
-
- statsAttackPoints = new gcn::Label("");
- statsDefensePoints = new gcn::Label("");
- statsMagicAttackPoints = new gcn::Label("");
- statsMagicDefensePoints = new gcn::Label("");
- statsAccuracyPoints = new gcn::Label("% Accuracy:");
- statsEvadePoints = new gcn::Label("% Evade:");
- statsReflexPoints = new gcn::Label("% Reflex:");
+ mStatsAttackLabel = new gcn::Label("Attack:");
+ mStatsDefenseLabel= new gcn::Label("Defense:");
+ mStatsMagicAttackLabel = new gcn::Label("M.Attack:");
+ mStatsMagicDefenseLabel = new gcn::Label("M.Defense:");
+ mStatsAccuracyLabel = new gcn::Label("% Accuracy:");
+ mStatsEvadeLabel = new gcn::Label("% Evade:");
+ mStatsReflexLabel = new gcn::Label("% Reflex:");
+
+ mStatsAttackPoints = new gcn::Label("");
+ mStatsDefensePoints = new gcn::Label("");
+ mStatsMagicAttackPoints = new gcn::Label("");
+ mStatsMagicDefensePoints = new gcn::Label("");
+ mStatsAccuracyPoints = new gcn::Label("% Accuracy:");
+ mStatsEvadePoints = new gcn::Label("% Evade:");
+ mStatsReflexPoints = new gcn::Label("% Reflex:");
// New labels
for (int i = 0; i < 6; i++) {
- statsLabel[i] = new gcn::Label();
- statsDisplayLabel[i] = new gcn::Label();
- pointsLabel[i] = new gcn::Label("0");
+ mStatsLabel[i] = new gcn::Label();
+ mStatsDisplayLabel[i] = new gcn::Label();
+ mPointsLabel[i] = new gcn::Label("0");
}
- remainingStatsPointsLabel = new gcn::Label();
+ mRemainingStatsPointsLabel = new gcn::Label();
// Set button events Id
- statsButton[0] = new Button("+", "STR", this);
- statsButton[1] = new Button("+", "AGI", this);
- statsButton[2] = new Button("+", "VIT", this);
- statsButton[3] = new Button("+", "INT", this);
- statsButton[4] = new Button("+", "DEX", this);
- statsButton[5] = new Button("+", "LUK", this);
+ mStatsButton[0] = new Button("+", "STR", this);
+ mStatsButton[1] = new Button("+", "AGI", this);
+ mStatsButton[2] = new Button("+", "VIT", this);
+ mStatsButton[3] = new Button("+", "INT", this);
+ mStatsButton[4] = new Button("+", "DEX", this);
+ mStatsButton[5] = new Button("+", "LUK", this);
// Set position
- statsTitleLabel->setPosition(mpLabel->getX(), mpLabel->getY() + 23 );
- statsTotalLabel->setPosition(110, statsTitleLabel->getY() + 15);
- int totalLabelY = statsTotalLabel->getY();
- statsCostLabel->setPosition(170, totalLabelY);
+ mStatsTitleLabel->setPosition(mMpLabel->getX(), mMpLabel->getY() + 23 );
+ mStatsTotalLabel->setPosition(110, mStatsTitleLabel->getY() + 15);
+ int totalLabelY = mStatsTotalLabel->getY();
+ mStatsCostLabel->setPosition(170, totalLabelY);
for (int i = 0; i < 6; i++)
{
- statsLabel[i]->setPosition(5, statsTotalLabel->getY() + (i * 23) + 15);
- statsDisplayLabel[i]->setPosition(115,
+ mStatsLabel[i]->setPosition(5, mStatsTotalLabel->getY() + (i * 23) + 15);
+ mStatsDisplayLabel[i]->setPosition(115,
totalLabelY + (i * 23) + 15);
- statsButton[i]->setPosition(145, totalLabelY + (i * 23) + 10);
- pointsLabel[i]->setPosition(175, totalLabelY + (i * 23) + 15);
+ mStatsButton[i]->setPosition(145, totalLabelY + (i * 23) + 10);
+ mPointsLabel[i]->setPosition(175, totalLabelY + (i * 23) + 15);
}
- remainingStatsPointsLabel->setPosition(5, pointsLabel[5]->getY() + 25);
+ mRemainingStatsPointsLabel->setPosition(5, mPointsLabel[5]->getY() + 25);
- statsAttackLabel->setPosition(220, statsLabel[0]->getY());
- statsDefenseLabel->setPosition(220, statsLabel[1]->getY());
- statsMagicAttackLabel->setPosition(220, statsLabel[2]->getY());
- statsMagicDefenseLabel->setPosition(220, statsLabel[3]->getY());
- statsAccuracyLabel->setPosition(220, statsLabel[4]->getY());
- statsEvadeLabel->setPosition(220, statsLabel[5]->getY());
- statsReflexLabel->setPosition(220, remainingStatsPointsLabel->getY());
+ mStatsAttackLabel->setPosition(220, mStatsLabel[0]->getY());
+ mStatsDefenseLabel->setPosition(220, mStatsLabel[1]->getY());
+ mStatsMagicAttackLabel->setPosition(220, mStatsLabel[2]->getY());
+ mStatsMagicDefenseLabel->setPosition(220, mStatsLabel[3]->getY());
+ mStatsAccuracyLabel->setPosition(220, mStatsLabel[4]->getY());
+ mStatsEvadeLabel->setPosition(220, mStatsLabel[5]->getY());
+ mStatsReflexLabel->setPosition(220, mRemainingStatsPointsLabel->getY());
- statsAttackPoints->setPosition(310, statsLabel[0]->getY());
- statsDefensePoints->setPosition(310, statsLabel[1]->getY());
- statsMagicAttackPoints->setPosition(310, statsLabel[2]->getY());
- statsMagicDefensePoints->setPosition(310, statsLabel[3]->getY());
- statsAccuracyPoints->setPosition(310, statsLabel[4]->getY());
- statsEvadePoints->setPosition(310, statsLabel[5]->getY());
- statsReflexPoints->setPosition(310, remainingStatsPointsLabel->getY());
+ mStatsAttackPoints->setPosition(310, mStatsLabel[0]->getY());
+ mStatsDefensePoints->setPosition(310, mStatsLabel[1]->getY());
+ mStatsMagicAttackPoints->setPosition(310, mStatsLabel[2]->getY());
+ mStatsMagicDefensePoints->setPosition(310, mStatsLabel[3]->getY());
+ mStatsAccuracyPoints->setPosition(310, mStatsLabel[4]->getY());
+ mStatsEvadePoints->setPosition(310, mStatsLabel[5]->getY());
+ mStatsReflexPoints->setPosition(310, mRemainingStatsPointsLabel->getY());
// Assemble
- add(statsTitleLabel);
- add(statsTotalLabel);
- add(statsCostLabel);
+ add(mStatsTitleLabel);
+ add(mStatsTotalLabel);
+ add(mStatsCostLabel);
for(int i = 0; i < 6; i++)
{
- add(statsLabel[i]);
- add(statsDisplayLabel[i]);
- add(statsButton[i]);
- add(pointsLabel[i]);
+ add(mStatsLabel[i]);
+ add(mStatsDisplayLabel[i]);
+ add(mStatsButton[i]);
+ add(mPointsLabel[i]);
}
- add(statsAttackLabel);
- add(statsDefenseLabel);
- add(statsMagicAttackLabel);
- add(statsMagicDefenseLabel);
- add(statsAccuracyLabel);
- add(statsEvadeLabel);
- add(statsReflexLabel);
-
- add(statsAttackPoints);
- add(statsDefensePoints);
- add(statsMagicAttackPoints);
- add(statsMagicDefensePoints);
- add(statsAccuracyPoints);
- add(statsEvadePoints);
- add(statsReflexPoints);
-
- add(remainingStatsPointsLabel);
+ add(mStatsAttackLabel);
+ add(mStatsDefenseLabel);
+ add(mStatsMagicAttackLabel);
+ add(mStatsMagicDefenseLabel);
+ add(mStatsAccuracyLabel);
+ add(mStatsEvadeLabel);
+ add(mStatsReflexLabel);
+
+ add(mStatsAttackPoints);
+ add(mStatsDefensePoints);
+ add(mStatsMagicAttackPoints);
+ add(mStatsMagicDefensePoints);
+ add(mStatsAccuracyPoints);
+ add(mStatsEvadePoints);
+ add(mStatsReflexPoints);
+
+ add(mRemainingStatsPointsLabel);
}
void StatusWindow::update()
@@ -214,61 +214,61 @@ void StatusWindow::update()
// Status Part
// -----------
updateText.str("");
- updateText << "Level: " << mPlayer->lvl;
- lvlLabel->setCaption(updateText.str());
- lvlLabel->adjustSize();
+ updateText << "Level: " << mPlayer->mLevel;
+ mLvlLabel->setCaption(updateText.str());
+ mLvlLabel->adjustSize();
updateText.str("");
- updateText << "Money: " << mPlayer->gp << " GP";
- gpLabel->setCaption(updateText.str());
- gpLabel->adjustSize();
+ updateText << "Money: " << mPlayer->mGp << " GP";
+ mGpLabel->setCaption(updateText.str());
+ mGpLabel->adjustSize();
updateText.str("");
- updateText << "Job: " << mPlayer->jobLvl;
- jobXpLabel->setCaption(updateText.str());
- jobXpLabel->adjustSize();
+ updateText << "Job: " << mPlayer->mJobLevel;
+ mJobXpLabel->setCaption(updateText.str());
+ mJobXpLabel->adjustSize();
updateText.str("");
- updateText << mPlayer->hp << "/" << mPlayer->maxHp;
- hpValueLabel->setCaption(updateText.str());
- hpValueLabel->adjustSize();
+ updateText << mPlayer->mHp << "/" << mPlayer->mMaxHp;
+ mHpValueLabel->setCaption(updateText.str());
+ mHpValueLabel->adjustSize();
updateText.str("");
- updateText << mPlayer->mp << "/" << mPlayer->maxMp;
- mpValueLabel->setCaption(updateText.str());
- mpValueLabel->adjustSize();
+ updateText << mPlayer->mMp << "/" << mPlayer->mMaxMp;
+ mMpValueLabel->setCaption(updateText.str());
+ mMpValueLabel->adjustSize();
updateText.str("");
- updateText << (int)mPlayer->xp << "/" << (int)mPlayer->xpForNextLevel;
- xpValueLabel->setCaption(updateText.str());
- xpValueLabel->adjustSize();
+ updateText << (int)mPlayer->mXp << "/" << (int)mPlayer->mXpForNextLevel;
+ mXpValueLabel->setCaption(updateText.str());
+ mXpValueLabel->adjustSize();
updateText.str("");
- updateText << (int)mPlayer->jobXp << "/" << (int)mPlayer->jobXpForNextLevel;
- jobValueLabel->setCaption(updateText.str());
- jobValueLabel->adjustSize();
+ updateText << (int)mPlayer->mJobXp << "/" << (int)mPlayer->mJobXpForNextLevel;
+ mJobValueLabel->setCaption(updateText.str());
+ mJobValueLabel->adjustSize();
// HP Bar coloration
- if (mPlayer->hp < int(mPlayer->maxHp / 3))
+ if (mPlayer->mHp < int(mPlayer->mMaxHp / 3))
{
- hpBar->setColor(223, 32, 32); // Red
+ mHpBar->setColor(223, 32, 32); // Red
}
- else if (mPlayer->hp < int((mPlayer->maxHp / 3) * 2))
+ else if (mPlayer->mHp < int((mPlayer->mMaxHp / 3) * 2))
{
- hpBar->setColor(230, 171, 34); // Orange
+ mHpBar->setColor(230, 171, 34); // Orange
}
else
{
- hpBar->setColor(0, 171, 34); // Green
+ mHpBar->setColor(0, 171, 34); // Green
}
- hpBar->setProgress((float)mPlayer->hp / (float)mPlayer->maxHp);
- // mpBar->setProgress((float)mPlayer->mp / (float)mPlayer->maxMp);
+ mHpBar->setProgress((float)mPlayer->mHp / (float)mPlayer->mMaxHp);
+ // mMpBar->setProgress((float)mPlayer->mp / (float)mPlayer->maxMp);
- xpBar->setProgress(
- (float)mPlayer->xp / (float)mPlayer->xpForNextLevel);
- jobXpBar->setProgress(
- (float)mPlayer->jobXp / (float)mPlayer->jobXpForNextLevel);
+ mXpBar->setProgress(
+ (float)mPlayer->mXp / (float)mPlayer->mXpForNextLevel);
+ mJobXpBar->setProgress(
+ (float)mPlayer->mJobXp / (float)mPlayer->mJobXpForNextLevel);
// Stats Part
// ----------
@@ -281,7 +281,7 @@ void StatusWindow::update()
"Luck"
};
- int statusPoints = mPlayer->statsPointsToAttribute;
+ int statusPoints = mPlayer->mStatsPointsToAttribute;
updateText.str("");
updateText << "Remaining Status Points: " << statusPoints;
@@ -290,83 +290,83 @@ void StatusWindow::update()
for (int i = 0; i < 6; i++) {
std::stringstream sstr;
- statsLabel[i]->setCaption(attrNames[i]);
- statsLabel[i]->adjustSize();
+ mStatsLabel[i]->setCaption(attrNames[i]);
+ mStatsLabel[i]->adjustSize();
sstr.str("");
- sstr << (int)mPlayer->ATTR[i];
- statsDisplayLabel[i]->setCaption(sstr.str());
- statsDisplayLabel[i]->adjustSize();
+ sstr << (int)mPlayer->mAttr[i];
+ mStatsDisplayLabel[i]->setCaption(sstr.str());
+ mStatsDisplayLabel[i]->adjustSize();
sstr.str("");
- sstr << (int)mPlayer->ATTR_UP[i];
- pointsLabel[i]->setCaption(sstr.str());
- pointsLabel[i]->adjustSize();
+ sstr << (int)mPlayer->mAttrUp[i];
+ mPointsLabel[i]->setCaption(sstr.str());
+ mPointsLabel[i]->adjustSize();
- statsButton[i]->setEnabled(mPlayer->ATTR_UP[i] <= statusPoints);
+ mStatsButton[i]->setEnabled(mPlayer->mAttrUp[i] <= statusPoints);
}
- remainingStatsPointsLabel->setCaption(updateText.str());
- remainingStatsPointsLabel->adjustSize();
+ mRemainingStatsPointsLabel->setCaption(updateText.str());
+ mRemainingStatsPointsLabel->adjustSize();
// Derived Stats Points
// Attack TODO: Count equipped Weapons and items attack bonuses
updateText.str("");
updateText << int(mPlayer->ATK + mPlayer->ATK_BONUS);
- statsAttackPoints->setCaption(updateText.str());
- statsAttackPoints->adjustSize();
+ mStatsAttackPoints->setCaption(updateText.str());
+ mStatsAttackPoints->adjustSize();
// Defense TODO: Count equipped Armors and items defense bonuses
updateText.str("");
updateText << int(mPlayer->DEF + mPlayer->DEF_BONUS);
- statsDefensePoints->setCaption(updateText.str());
- statsDefensePoints->adjustSize();
+ mStatsDefensePoints->setCaption(updateText.str());
+ mStatsDefensePoints->adjustSize();
// Magic Attack TODO: Count equipped items M.Attack bonuses
updateText.str("");
updateText << int(mPlayer->MATK + mPlayer->MATK_BONUS);
- statsMagicAttackPoints->setCaption(updateText.str());
- statsMagicAttackPoints->adjustSize();
+ mStatsMagicAttackPoints->setCaption(updateText.str());
+ mStatsMagicAttackPoints->adjustSize();
// Magic Defense TODO: Count equipped items M.Defense bonuses
updateText.str("");
updateText << int(mPlayer->MDEF + mPlayer->MDEF_BONUS);
- statsMagicDefensePoints->setCaption(updateText.str());
- statsMagicDefensePoints->adjustSize();
+ mStatsMagicDefensePoints->setCaption(updateText.str());
+ mStatsMagicDefensePoints->adjustSize();
// Accuracy %
updateText.str("");
updateText << (int)mPlayer->HIT;
- statsAccuracyPoints->setCaption(updateText.str());
- statsAccuracyPoints->adjustSize();
+ mStatsAccuracyPoints->setCaption(updateText.str());
+ mStatsAccuracyPoints->adjustSize();
// Evasion %
updateText.str("");
updateText << (int)mPlayer->FLEE;
- statsEvadePoints->setCaption(updateText.str());
- statsEvadePoints->adjustSize();
+ mStatsEvadePoints->setCaption(updateText.str());
+ mStatsEvadePoints->adjustSize();
// Reflex %
updateText.str("");
updateText << ((int)mPlayer->DEX / 4); // + counter
- statsReflexPoints->setCaption(updateText.str());
- statsReflexPoints->adjustSize();
+ mStatsReflexPoints->setCaption(updateText.str());
+ mStatsReflexPoints->adjustSize();
// Update Second column widgets position
- gpLabel->setPosition(lvlLabel->getX() + lvlLabel->getWidth() + 20,
- lvlLabel->getY());
-
- xpLabel->setPosition(hpValueLabel->getX() + hpValueLabel->getWidth() + 10,
- hpLabel->getY());
- xpBar->setPosition(xpLabel->getX() + xpLabel->getWidth() + 5,
- xpLabel->getY());
- xpValueLabel->setPosition(xpBar->getX() + xpBar->getWidth() + 5,
- xpLabel->getY());
-
- jobXpLabel->setPosition(xpLabel->getX(), mpLabel->getY());
- jobXpBar->setPosition(xpBar->getX() + xpBar->getWidth() -
- jobXpBar->getWidth(), jobXpLabel->getY());
- jobValueLabel->setPosition(290, jobXpLabel->getY());
+ mGpLabel->setPosition(mLvlLabel->getX() + mLvlLabel->getWidth() + 20,
+ mLvlLabel->getY());
+
+ mXpLabel->setPosition(mHpValueLabel->getX() + mHpValueLabel->getWidth() + 10,
+ mHpLabel->getY());
+ mXpBar->setPosition(mXpLabel->getX() + mXpLabel->getWidth() + 5,
+ mXpLabel->getY());
+ mXpValueLabel->setPosition(mXpBar->getX() + mXpBar->getWidth() + 5,
+ mXpLabel->getY());
+
+ mJobXpLabel->setPosition(mXpLabel->getX(), mMpLabel->getY());
+ mJobXpBar->setPosition(mXpBar->getX() + mXpBar->getWidth() -
+ mJobXpBar->getWidth(), mJobXpLabel->getY());
+ mJobValueLabel->setPosition(290, mJobXpLabel->getY());
}
void StatusWindow::draw(gcn::Graphics *g)
diff --git a/src/gui/status.h b/src/gui/status.h
index c01b5676..66068a7d 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -69,39 +69,37 @@ class StatusWindow : public Window, public gcn::ActionListener {
/**
* Status Part
*/
- gcn::Label *lvlLabel, *gpLabel, *hpLabel, *hpValueLabel, *mpLabel, *mpValueLabel;
- gcn::Label *xpLabel, *xpValueLabel, *jobXpLabel, *jobValueLabel;
- ProgressBar *hpBar, *mpBar;
- ProgressBar *xpBar, *jobXpBar;
-
- /**
- * Caracteristics Part
- */
- gcn::Label *statsTitleLabel, *statsTotalLabel, *statsCostLabel;
+ gcn::Label *mLvlLabel, *mGpLabel, *mHpLabel, *mHpValueLabel;
+ gcn::Label *mMpLabel, *mMpValueLabel;
+ gcn::Label *mXpLabel, *mXpValueLabel, *mJobXpLabel, *mJobValueLabel;
+ ProgressBar *mHpBar, *mMpBar;
+ ProgressBar *mXpBar, *mJobXpBar;
/**
* Derived Statistics captions
*/
- gcn::Label *statsAttackLabel, *statsDefenseLabel, *statsMagicAttackLabel;
- gcn::Label *statsMagicDefenseLabel, *statsAccuracyLabel, *statsEvadeLabel;
- gcn::Label *statsReflexLabel;
+ gcn::Label *mStatsAttackLabel, *mStatsDefenseLabel;
+ gcn::Label *mStatsMagicAttackLabel, *mStatsMagicDefenseLabel;
+ gcn::Label *mStatsAccuracyLabel, *mStatsEvadeLabel;
+ gcn::Label *mStatsReflexLabel;
- gcn::Label *statsAttackPoints, *statsDefensePoints, *statsMagicAttackPoints;
- gcn::Label *statsMagicDefensePoints, *statsAccuracyPoints, *statsEvadePoints;
- gcn::Label *statsReflexPoints;
+ gcn::Label *mStatsAttackPoints, *mStatsDefensePoints;
+ gcn::Label *mStatsMagicAttackPoints, *mStatsMagicDefensePoints;
+ gcn::Label *mStatsAccuracyPoints, *mStatsEvadePoints;
+ gcn::Label *mStatsReflexPoints;
/**
* Stats captions.
*/
- gcn::Label *statsLabel[6];
- gcn::Label *pointsLabel[6];
- gcn::Label *statsDisplayLabel[6];
- gcn::Label *remainingStatsPointsLabel;
+ gcn::Label *mStatsLabel[6];
+ gcn::Label *mPointsLabel[6];
+ gcn::Label *mStatsDisplayLabel[6];
+ gcn::Label *mRemainingStatsPointsLabel;
/**
* Stats buttons.
*/
- gcn::Button *statsButton[6];
+ gcn::Button *mStatsButton[6];
};
extern StatusWindow *statusWindow;
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 370b5410..ee7bca06 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -46,80 +46,80 @@
TradeWindow::TradeWindow(Network *network):
Window("Trade: You"),
mNetwork(network),
- myInventory(new Inventory()),
- partnerInventory(new Inventory())
+ mMyInventory(new Inventory()),
+ mPartnerInventory(new Inventory())
{
setContentSize(322, 150);
- addButton = new Button("Add", "add", this);
- okButton = new Button("Ok", "ok", this);
- cancelButton = new Button("Cancel", "cancel", this);
- tradeButton = new Button("Trade", "trade", this);
+ mAddButton = new Button("Add", "add", this);
+ mOkButton = new Button("Ok", "ok", this);
+ mCancelButton = new Button("Cancel", "cancel", this);
+ mTradeButton = new Button("Trade", "trade", this);
- myItemContainer = new ItemContainer(myInventory.get());
- myItemContainer->setPosition(2, 2);
+ mMyItemContainer = new ItemContainer(mMyInventory.get());
+ mMyItemContainer->setPosition(2, 2);
- myScroll = new ScrollArea(myItemContainer);
- myScroll->setPosition(8, 8);
+ mMyScroll = new ScrollArea(mMyItemContainer);
+ mMyScroll->setPosition(8, 8);
- partnerItemContainer = new ItemContainer(partnerInventory.get());
- partnerItemContainer->setPosition(2, 58);
+ mPartnerItemContainer = new ItemContainer(mPartnerInventory.get());
+ mPartnerItemContainer->setPosition(2, 58);
- partnerScroll = new ScrollArea(partnerItemContainer);
- partnerScroll->setPosition(8, 64);
+ mPartnerScroll = new ScrollArea(mPartnerItemContainer);
+ mPartnerScroll->setPosition(8, 64);
- moneyLabel = new gcn::Label("You get: 0z");
- moneyLabel2 = new gcn::Label("You give:");
- moneyField = new TextField();
+ mMoneyLabel = new gcn::Label("You get: 0z");
+ mMoneyLabel2 = new gcn::Label("You give:");
+ mMoneyField = new TextField();
- addButton->adjustSize();
- okButton->adjustSize();
- cancelButton->adjustSize();
- tradeButton->adjustSize();
+ mAddButton->adjustSize();
+ mOkButton->adjustSize();
+ mCancelButton->adjustSize();
+ mTradeButton->adjustSize();
- tradeButton->setEnabled(false);
+ mTradeButton->setEnabled(false);
- itemNameLabel = new gcn::Label("Name:");
- itemDescriptionLabel = new gcn::Label("Description:");
+ mItemNameLabel = new gcn::Label("Name:");
+ mItemDescriptionLabel = new gcn::Label("Description:");
- add(myScroll);
- add(partnerScroll);
- add(addButton);
- add(okButton);
- add(cancelButton);
- add(tradeButton);
- add(itemNameLabel);
- add(itemDescriptionLabel);
- add(moneyLabel2);
- add(moneyField);
- add(moneyLabel);
+ add(mMyScroll);
+ add(mPartnerScroll);
+ add(mAddButton);
+ add(mOkButton);
+ add(mCancelButton);
+ add(mTradeButton);
+ add(mItemNameLabel);
+ add(mItemDescriptionLabel);
+ add(mMoneyLabel2);
+ add(mMoneyField);
+ add(mMoneyLabel);
- moneyField->setPosition(8 + 60, getHeight() - 20);
- moneyField->setWidth(50);
+ mMoneyField->setPosition(8 + 60, getHeight() - 20);
+ mMoneyField->setWidth(50);
- moneyLabel->setPosition(8 + 60 + 50 + 6, getHeight() - 20);
- moneyLabel2->setPosition(8, getHeight() - 20);
+ mMoneyLabel->setPosition(8 + 60 + 50 + 6, getHeight() - 20);
+ mMoneyLabel2->setPosition(8, getHeight() - 20);
- cancelButton->setPosition(getWidth() - 48, getHeight() - 49);
- tradeButton->setPosition(cancelButton->getX() - 40
+ mCancelButton->setPosition(getWidth() - 48, getHeight() - 49);
+ mTradeButton->setPosition(mCancelButton->getX() - 40
, getHeight() - 49);
- okButton->setPosition(tradeButton->getX() - 24,
+ mOkButton->setPosition(mTradeButton->getX() - 24,
getHeight() - 49);
- addButton->setPosition(okButton->getX() - 32,
+ mAddButton->setPosition(mOkButton->getX() - 32,
getHeight() - 49);
- myItemContainer->setSize(getWidth() - 24 - 12 - 1,
+ mMyItemContainer->setSize(getWidth() - 24 - 12 - 1,
(INVENTORY_SIZE * 24) / (getWidth() / 24) - 1);
- myScroll->setSize(getWidth() - 16, (getHeight() - 76) / 2);
+ mMyScroll->setSize(getWidth() - 16, (getHeight() - 76) / 2);
- partnerItemContainer->setSize(getWidth() - 24 - 12 - 1,
+ mPartnerItemContainer->setSize(getWidth() - 24 - 12 - 1,
(INVENTORY_SIZE * 24) / (getWidth() / 24) - 1);
- partnerScroll->setSize(getWidth() - 16, (getHeight() - 76) / 2);
+ mPartnerScroll->setSize(getWidth() - 16, (getHeight() - 76) / 2);
- itemNameLabel->setPosition(8,
- partnerScroll->getY() + partnerScroll->getHeight() + 4);
- itemDescriptionLabel->setPosition(8,
- itemNameLabel->getY() + itemNameLabel->getHeight() + 4);
+ mItemNameLabel->setPosition(8,
+ mPartnerScroll->getY() + mPartnerScroll->getHeight() + 4);
+ mItemDescriptionLabel->setPosition(8,
+ mItemNameLabel->getY() + mItemNameLabel->getHeight() + 4);
setContentSize(getWidth(), getHeight());
}
@@ -132,83 +132,83 @@ void TradeWindow::addMoney(int amount)
{
std::stringstream tempMoney;
tempMoney << "You get: " << amount << "z";
- moneyLabel->setCaption(tempMoney.str());
- moneyLabel->adjustSize();
+ mMoneyLabel->setCaption(tempMoney.str());
+ mMoneyLabel->adjustSize();
}
void TradeWindow::addItem(int id, bool own, int quantity, bool equipment)
{
if (own) {
- myInventory->addItem(id, quantity, equipment);
+ mMyInventory->addItem(id, quantity, equipment);
} else {
- partnerInventory->addItem(id, quantity, equipment);
+ mPartnerInventory->addItem(id, quantity, equipment);
}
}
void TradeWindow::removeItem(int id, bool own)
{
if (own) {
- myInventory->removeItem(id);
+ mMyInventory->removeItem(id);
} else {
- partnerInventory->removeItem(id);
+ mPartnerInventory->removeItem(id);
}
}
void TradeWindow::changeQuantity(int index, bool own, int quantity)
{
if (own) {
- myInventory->getItem(index)->setQuantity(quantity);
+ mMyInventory->getItem(index)->setQuantity(quantity);
} else {
- partnerInventory->getItem(index)->setQuantity(quantity);
+ mPartnerInventory->getItem(index)->setQuantity(quantity);
}
}
void TradeWindow::increaseQuantity(int index, bool own, int quantity)
{
if (own) {
- myInventory->getItem(index)->increaseQuantity(quantity);
+ mMyInventory->getItem(index)->increaseQuantity(quantity);
} else {
- partnerInventory->getItem(index)->increaseQuantity(quantity);
+ mPartnerInventory->getItem(index)->increaseQuantity(quantity);
}
}
void TradeWindow::reset()
{
- myInventory->clear();
- partnerInventory->clear();
- tradeButton->setEnabled(false);
- okButton->setEnabled(true);
- ok_other = false;
- ok_me = false;
- moneyLabel->setCaption("You get: 0z");
- moneyField->setEnabled(true);
- moneyField->setText("");
+ mMyInventory->clear();
+ mPartnerInventory->clear();
+ mTradeButton->setEnabled(false);
+ mOkButton->setEnabled(true);
+ mOkOther = false;
+ mOkMe = false;
+ mMoneyLabel->setCaption("You get: 0z");
+ mMoneyField->setEnabled(true);
+ mMoneyField->setText("");
}
void TradeWindow::setTradeButton(bool enabled)
{
- tradeButton->setEnabled(enabled);
+ mTradeButton->setEnabled(enabled);
}
void TradeWindow::receivedOk(bool own)
{
if (own) {
- ok_me = true;
- if (ok_other) {
- tradeButton->setEnabled(true);
- okButton->setEnabled(false);
+ mOkMe = true;
+ if (mOkOther) {
+ mTradeButton->setEnabled(true);
+ mOkButton->setEnabled(false);
} else {
- tradeButton->setEnabled(false);
- okButton->setEnabled(false);
+ mTradeButton->setEnabled(false);
+ mOkButton->setEnabled(false);
}
} else {
- ok_other = true;
- if (ok_me) {
- tradeButton->setEnabled(true);
- okButton->setEnabled(false);
+ mOkOther = true;
+ if (mOkMe) {
+ mTradeButton->setEnabled(true);
+ mOkButton->setEnabled(false);
} else {
- tradeButton->setEnabled(false);
- okButton->setEnabled(true);
+ mTradeButton->setEnabled(false);
+ mOkButton->setEnabled(true);
}
}
}
@@ -227,23 +227,23 @@ void TradeWindow::mouseClick(int x, int y, int button, int count)
Item *item;
- // myItems selected
- if (x >= myScroll->getX() + 3
- && x <= myScroll->getX() + myScroll->getWidth() - 10
- && y >= myScroll->getY() + 16
- && y <= myScroll->getY() + myScroll->getHeight() + 15
- && (item = myItemContainer->getItem()))
+ // mMyItems selected
+ if (x >= mMyScroll->getX() + 3
+ && x <= mMyScroll->getX() + mMyScroll->getWidth() - 10
+ && y >= mMyScroll->getY() + 16
+ && y <= mMyScroll->getY() + mMyScroll->getHeight() + 15
+ && (item = mMyItemContainer->getItem()))
{
- partnerItemContainer->selectNone();
- // partnerItems selected
+ mPartnerItemContainer->selectNone();
+ // mPartnerItems selected
}
- else if (x >= partnerScroll->getX() + 3
- && x <= partnerScroll->getX() + partnerScroll->getWidth() - 20
- && y >= partnerScroll->getY() + 16
- && y <= partnerScroll->getY() + partnerScroll->getHeight() + 15
- && (item = partnerItemContainer->getItem()))
+ else if (x >= mPartnerScroll->getX() + 3
+ && x <= mPartnerScroll->getX() + mPartnerScroll->getWidth() - 20
+ && y >= mPartnerScroll->getY() + 16
+ && y <= mPartnerScroll->getY() + mPartnerScroll->getHeight() + 15
+ && (item = mPartnerItemContainer->getItem()))
{
- myItemContainer->selectNone();
+ mMyItemContainer->selectNone();
} else {
return;
}
@@ -251,11 +251,11 @@ void TradeWindow::mouseClick(int x, int y, int button, int count)
// Show Name and Description
std::string SomeText;
SomeText = "Name: " + item->getInfo()->getName();
- itemNameLabel->setCaption(SomeText);
- itemNameLabel->adjustSize();
+ mItemNameLabel->setCaption(SomeText);
+ mItemNameLabel->adjustSize();
SomeText = "Description: " + item->getInfo()->getDescription();
- itemDescriptionLabel->setCaption(SomeText);
- itemDescriptionLabel->adjustSize();
+ mItemDescriptionLabel->setCaption(SomeText);
+ mItemDescriptionLabel->adjustSize();
}
void TradeWindow::action(const std::string &eventId)
@@ -267,11 +267,11 @@ void TradeWindow::action(const std::string &eventId)
return;
}
- if (myInventory->getFreeSlot() < 1) {
+ if (mMyInventory->getFreeSlot() < 1) {
return;
}
- if (myInventory->contains(item)) {
+ if (mMyInventory->contains(item)) {
chatWindow->chatLog("Failed adding item. You can not "
"overlap one kind of item on the window.", BY_SERVER);
return;
@@ -293,21 +293,21 @@ void TradeWindow::action(const std::string &eventId)
else if (eventId == "ok")
{
std::stringstream tempMoney[2];
- tempMoney[0] << moneyField->getText();
+ tempMoney[0] << mMoneyField->getText();
int tempInt;
if (tempMoney[0] >> tempInt)
{
tempMoney[1] << tempInt;
- moneyField->setText(tempMoney[1].str());
+ mMoneyField->setText(tempMoney[1].str());
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(0);
outMsg.writeInt32(tempInt);
} else {
- moneyField->setText("");
+ mMoneyField->setText("");
}
- moneyField->setEnabled(false);
+ mMoneyField->setEnabled(false);
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_ADD_COMPLETE);
}
diff --git a/src/gui/trade.h b/src/gui/trade.h
index 3d6eef53..8bf4b86d 100644
--- a/src/gui/trade.h
+++ b/src/gui/trade.h
@@ -116,20 +116,20 @@ class TradeWindow : public Window, gcn::ActionListener
Network *mNetwork;
typedef std::auto_ptr<Inventory> InventoryPtr;
- InventoryPtr myInventory;
- InventoryPtr partnerInventory;
-
- ItemContainer *myItemContainer;
- ItemContainer *partnerItemContainer;
-
- gcn::Label *itemNameLabel;
- gcn::Label *itemDescriptionLabel;
- gcn::Label *moneyLabel;
- gcn::Label *moneyLabel2;
- gcn::Button *addButton, *okButton, *cancelButton, *tradeButton;
- ScrollArea *myScroll, *partnerScroll;
- gcn::TextField *moneyField;
- bool ok_other, ok_me;
+ InventoryPtr mMyInventory;
+ InventoryPtr mPartnerInventory;
+
+ ItemContainer *mMyItemContainer;
+ ItemContainer *mPartnerItemContainer;
+
+ gcn::Label *mItemNameLabel;
+ gcn::Label *mItemDescriptionLabel;
+ gcn::Label *mMoneyLabel;
+ gcn::Label *mMoneyLabel2;
+ gcn::Button *mAddButton, *mOkButton, *mCancelButton, *mTradeButton;
+ ScrollArea *mMyScroll, *mPartnerScroll;
+ gcn::TextField *mMoneyField;
+ bool mOkOther, mOkMe;
};
extern TradeWindow *tradeWindow;
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index a6f82b45..3b577116 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -71,15 +71,15 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
gcn::Window(caption),
mParent(parent),
mWindowName("window"),
- snapSize(8),
+ mSnapSize(8),
mShowTitle(true),
mModal(modal),
- resizable(false),
+ mResizable(false),
mMouseResize(false),
- minWinWidth(6),
- minWinHeight(23),
- maxWinWidth(INT_MAX),
- maxWinHeight(INT_MAX)
+ mMinWinWidth(6),
+ mMinWinHeight(23),
+ mMaxWinWidth(INT_MAX),
+ mMaxWinHeight(INT_MAX)
{
logger->log("Window::Window(\"%s\")", caption.c_str());
@@ -138,7 +138,7 @@ Window::~Window()
config.setValue(name + "WinX", getX());
config.setValue(name + "WinY", getY());
- if (resizable)
+ if (mResizable)
{
config.setValue(name + "WinWidth", getWidth());
config.setValue(name + "WinHeight", getHeight());
@@ -180,7 +180,7 @@ void Window::draw(gcn::Graphics* graphics)
g->drawImageRect(0, 0, getWidth(), getHeight(), border);
// Draw grip
- if (resizable)
+ if (mResizable)
{
g->drawImage(Window::resizeGrip,
getWidth() - resizeGrip->getWidth(),
@@ -228,32 +228,32 @@ void Window::setContentSize(int width, int height)
void Window::setMinWidth(unsigned int width)
{
- minWinWidth = width;
+ mMinWinWidth = width;
}
void Window::setMinHeight(unsigned int height)
{
- minWinHeight = height;
+ mMinWinHeight = height;
}
void Window::setMaxWidth(unsigned int width)
{
- maxWinWidth = width;
+ mMaxWinWidth = width;
}
void Window::setMaxHeight(unsigned int height)
{
- maxWinHeight = height;
+ mMaxWinHeight = height;
}
void Window::setResizable(bool r)
{
- resizable = r;
+ mResizable = r;
}
bool Window::isResizable()
{
- return resizable;
+ return mResizable;
}
void Window::scheduleDelete()
@@ -357,22 +357,22 @@ void Window::mouseMotion(int x, int y)
int Xcorrection = 0;
int Ycorrection = 0;
- if (newDim.width < minWinWidth)
+ if (newDim.width < mMinWinWidth)
{
- Xcorrection = minWinWidth - newDim.width;
+ Xcorrection = mMinWinWidth - newDim.width;
}
- else if (newDim.width > maxWinWidth)
+ else if (newDim.width > mMaxWinWidth)
{
- Xcorrection = maxWinWidth - newDim.width;
+ Xcorrection = mMaxWinWidth - newDim.width;
}
- if (newDim.height < minWinHeight)
+ if (newDim.height < mMinWinHeight)
{
- Ycorrection = minWinHeight - newDim.height;
+ Ycorrection = mMinWinHeight - newDim.height;
}
- else if (newDim.height > maxWinHeight)
+ else if (newDim.height > mMaxWinHeight)
{
- Ycorrection = maxWinHeight - newDim.height;
+ Ycorrection = mMaxWinHeight - newDim.height;
}
// Snap window to edges
@@ -425,7 +425,7 @@ Window::loadWindowState()
setPosition((int)config.getValue(name + "WinX", getX()),
(int)config.getValue(name + "WinY", getY()));
- if (resizable)
+ if (mResizable)
{
setWidth((int)config.getValue(name + "WinWidth", getWidth()));
setHeight((int)config.getValue(name + "WinHeight", getHeight()));
diff --git a/src/gui/window.h b/src/gui/window.h
index 4f20f721..42ce444c 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -199,15 +199,15 @@ class Window : public gcn::Window
GCContainer *mChrome; /**< Contained container */
Window *mParent; /**< The parent window */
std::string mWindowName; /**< Name of the window */
- int snapSize; /**< Snap distance to window edge */
+ int mSnapSize; /**< Snap distance to window edge */
bool mShowTitle; /**< Window has a title bar */
bool mModal; /**< Window is modal */
- bool resizable; /**< Window can be resized */
+ bool mResizable; /**< Window can be resized */
bool mMouseResize; /**< Window is being resized */
- int minWinWidth; /**< Minimum window width */
- int minWinHeight; /**< Minimum window height */
- int maxWinWidth; /**< Maximum window width */
- int maxWinHeight; /**< Maximum window height */
+ int mMinWinWidth; /**< Minimum window width */
+ int mMinWinHeight; /**< Minimum window height */
+ int mMaxWinWidth; /**< Maximum window width */
+ int mMaxWinHeight; /**< Maximum window height */
int mDefaultX; /**< Default window X position */
int mDefaultY; /**< Default window Y position */
int mDefaultWidth; /**< Default window width */