diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 05:16:27 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 05:16:27 +0000 |
commit | e5f795ad9952b8bba6993ee3e324b22a0f104816 (patch) | |
tree | 1602ac0f74865135eae5acf935b0a285a8e918c2 | |
parent | 7593d6c71e2331c3e43c732db60ad03ee4d5385d (diff) | |
download | mana-e5f795ad9952b8bba6993ee3e324b22a0f104816.tar.gz mana-e5f795ad9952b8bba6993ee3e324b22a0f104816.tar.bz2 mana-e5f795ad9952b8bba6993ee3e324b22a0f104816.tar.xz mana-e5f795ad9952b8bba6993ee3e324b22a0f104816.zip |
Made all class members named like mClassMember.
81 files changed, 1897 insertions, 1913 deletions
@@ -1,5 +1,33 @@ 2006-03-09 Björn Steinbrink <B.Steinbrink@gmx.de> + * src/openglgraphics.cpp, src/localplayer.cpp, src/game.cpp, + src/map.cpp, src/log.cpp, src/being.cpp, src/monster.cpp, src/sound.h, + src/graphics.cpp, src/gui/equipmentwindow.cpp, src/gui/sell.cpp, + src/gui/trade.cpp, src/gui/char_server.cpp, src/gui/window.cpp, + src/gui/login.cpp, src/gui/inttextbox.h, src/gui/chargedialog.h, + src/gui/focushandler.h, src/gui/skill.h, src/gui/gui.cpp, + src/gui/newskill.cpp, src/gui/register.h, src/gui/popupmenu.h, + src/gui/setup.cpp, src/gui/npclistdialog.h, src/gui/chargedialog.cpp, + src/gui/playerbox.h, src/gui/char_select.cpp, src/gui/login.h, + src/gui/focushandler.cpp, src/gui/chat.h, src/gui/inventorywindow.h, + src/gui/newskill.h, src/gui/ministatus.cpp, src/gui/buy.h, + src/gui/playerbox.cpp, src/gui/setup.h, src/gui/itemcontainer.h, + src/gui/debugwindow.cpp, src/gui/chat.cpp, src/gui/char_select.h, + src/gui/inventorywindow.cpp, src/gui/help.cpp, src/gui/status.h, + src/gui/buy.cpp, src/gui/itemcontainer.cpp, src/gui/equipmentwindow.h, + src/gui/sell.h, src/gui/trade.h, src/gui/ministatus.h, + src/gui/inttextbox.cpp, src/gui/char_server.h, src/gui/window.h, + src/gui/skill.cpp, src/gui/debugwindow.h, src/gui/status.cpp, + src/gui/register.cpp, src/gui/popupmenu.cpp, src/gui/minimap.cpp, + src/gui/npclistdialog.cpp, src/gui/help.h, src/net/buysellhandler.cpp, + src/net/beinghandler.cpp, src/net/charserverhandler.cpp, + src/net/maploginhandler.cpp, src/net/playerhandler.cpp, + src/engine.cpp, src/localplayer.h, src/beingmanager.cpp, src/map.h, + src/log.h, src/sound.cpp, src/resources/itemmanager.h, + src/resources/buddylist.cpp, src/resources/buddylist.h, + src/resources/image.cpp, src/resources/image.h, + src/resources/itemmanager.cpp, src/being.h, src/player.cpp: Made all + class members named like mClassMember. * src/floor_item.cpp, src/map.cpp, src/being.cpp, src/gui/equipmentwindow.cpp, src/gui/playerbox.cpp, src/gui/itemcontainer.cpp, src/graphic/spriteset.cpp, diff --git a/src/being.cpp b/src/being.cpp index 504c5ab4..5ee8276c 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -41,21 +41,21 @@ PATH_NODE::PATH_NODE(Uint16 iX, Uint16 iY): } Being::Being(Uint32 id, Uint16 job, Map *map): - job(job), - x(0), y(0), direction(DOWN), - action(0), mFrame(0), - speech_color(0), - walk_time(0), - emotion(0), emotion_time(0), - aspd(350), + mJob(job), + mX(0), mY(0), mDirection(DOWN), + mAction(0), mFrame(0), + mSpeechColor(0), + mWalkTime(0), + mEmotion(0), mEmotionTime(0), + mAttackSpeed(350), mId(id), mWeapon(0), mWalkSpeed(150), mMap(NULL), - hairStyle(1), hairColor(1), - speech_time(0), - damage_time(0), - showSpeech(false), showDamage(false), + mHairStyle(1), mHairColor(1), + mSpeechTime(0), + mDamageTime(0), + mShowSpeech(false), mShowDamage(false), mSpriteset(NULL), mSpriteFrame(0) { setMap(map); @@ -71,7 +71,7 @@ void Being::setDestination(Uint16 destX, Uint16 destY) { if (mMap) { - setPath(mMap->findPath(x, y, destX, destY)); + setPath(mMap->findPath(mX, mY, destX, destY)); } } @@ -84,51 +84,51 @@ void Being::setPath(const Path &path) { mPath = path; - if (action != WALK && action != DEAD) + if (mAction != WALK && mAction != DEAD) { nextStep(); - walk_time = tick_time; + mWalkTime = tick_time; } } void Being::setHairColor(Uint16 color) { - hairColor = color; - if (hairColor < 1 || hairColor > NR_HAIR_COLORS + 1) + mHairColor = color; + if (mHairColor < 1 || mHairColor > NR_HAIR_COLORS + 1) { - hairColor = 1; + mHairColor = 1; } } void Being::setHairStyle(Uint16 style) { - hairStyle = style; - if (hairStyle < 1 || hairStyle > NR_HAIR_STYLES) + mHairStyle = style; + if (mHairStyle < 1 || mHairStyle > NR_HAIR_STYLES) { - hairStyle = 1; + mHairStyle = 1; } } void Being::setSpeech(const std::string &text, Uint32 time) { - speech = text; - speech_time = tick_time; - showSpeech = true; + mSpeech = text; + mSpeechTime = tick_time; + mShowSpeech = true; } void Being::setDamage(Sint16 amount, Uint32 time) { if (!amount) { - damage = "miss"; + mDamage = "miss"; } else { std::stringstream damageString; damageString << amount; - damage = damageString.str(); + mDamage = damageString.str(); } - damage_time = tick_time; - showDamage = true; + mDamageTime = tick_time; + mShowDamage = true; } void @@ -156,56 +156,56 @@ Being::nextStep() if (mPath.empty()) { - action = STAND; + mAction = STAND; return; } PATH_NODE node = mPath.front(); mPath.pop_front(); - direction = 0; - if (node.x > x) - direction |= RIGHT; - else if (node.x < x) - direction |= LEFT; - if (node.y > y) - direction |= DOWN; - else if (node.y < y) - direction |= UP; - - x = node.x; - y = node.y; - action = WALK; - walk_time += mWalkSpeed / 10; + mDirection = 0; + if (node.x > mX) + mDirection |= RIGHT; + else if (node.x < mX) + mDirection |= LEFT; + if (node.y > mY) + mDirection |= DOWN; + else if (node.y < mY) + mDirection |= UP; + + mX = node.x; + mY = node.y; + mAction = WALK; + mWalkTime += mWalkSpeed / 10; } void Being::logic() { // Determine whether speech should still be displayed - if (get_elapsed_time(speech_time) > 5000) + if (get_elapsed_time(mSpeechTime) > 5000) { - showSpeech = false; + mShowSpeech = false; } // Determine whether damage should still be displayed - if (get_elapsed_time(damage_time) > 3000) + if (get_elapsed_time(mDamageTime) > 3000) { - showDamage = false; + mShowDamage = false; } // Update pixel coordinates - mPx = x * 32; - mPy = y * 32; + mPx = mX * 32; + mPy = mY * 32; mPy += getYOffset(); mPx += getXOffset(); - if (emotion != 0) + if (mEmotion != 0) { - emotion_time--; - if (emotion_time == 0) { - emotion = 0; + mEmotionTime--; + if (mEmotionTime == 0) { + mEmotion = 0; } } } @@ -227,9 +227,9 @@ Being::drawEmotion(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) int px = mPx + offsetX; int py = mPy + offsetY; - if (emotion) + if (mEmotion) { - graphics->drawImage(emotionset->get(emotion - 1), + graphics->drawImage(emotionset->get(mEmotion - 1), px + 3, py - 60); } } @@ -241,17 +241,17 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) int py = mPy + offsetY; // Draw speech above this being - if (showSpeech) + if (mShowSpeech) { graphics->setFont(speechFont); - graphics->drawText(speech, px + 18, py - 60, gcn::Graphics::CENTER); + graphics->drawText(mSpeech, px + 18, py - 60, gcn::Graphics::CENTER); } // Draw damage above this being - if (showDamage) + if (mShowDamage) { // Selecting the right color - if (damage == "miss") + if (mDamage == "miss") { graphics->setFont(hitYellowFont); } @@ -265,13 +265,13 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) } int textY = (getType() == MONSTER) ? 32 : 70; - int ft = get_elapsed_time(damage_time) - 1500; + int ft = get_elapsed_time(mDamageTime) - 1500; float a = (ft > 0) ? 1.0 - ft / 1500.0 : 1.0; graphics->setColor(gcn::Color(255, 255, 255, (int)(255 * a))); - graphics->drawText(damage, + graphics->drawText(mDamage, px + 16, - py - textY - get_elapsed_time(damage_time) / 100, + py - textY - get_elapsed_time(mDamageTime) / 100, gcn::Graphics::CENTER); // Reset alpha value @@ -317,11 +317,11 @@ void Being::setWeaponById(Uint16 weapon) int Being::getOffset(char pos, char neg) const { // Check whether we're walking in the requested direction - if (action != WALK || !(direction & (pos | neg))) { + if (mAction != WALK || !(mDirection & (pos | neg))) { return 0; } - int offset = (get_elapsed_time(walk_time) * 32) / mWalkSpeed; + int offset = (get_elapsed_time(mWalkTime) * 32) / mWalkSpeed; // We calculate the offset _from_ the _target_ location offset -= 32; @@ -330,7 +330,7 @@ int Being::getOffset(char pos, char neg) const } // Going into negative direction? Invert the offset. - if (direction & pos) { + if (mDirection & pos) { offset = -offset; } diff --git a/src/being.h b/src/being.h index a3884056..7aeb40a3 100644 --- a/src/being.h +++ b/src/being.h @@ -81,17 +81,17 @@ class Being : public Sprite static const char UP = 4; static const char RIGHT = 8; - Uint16 job; /**< Job (player job, npc, monster, ) */ - Uint16 x, y; /**< Tile coordinates */ - Uint8 direction; /**< Facing direction */ - Uint8 action; + Uint16 mJob; /**< Job (player job, npc, monster, ) */ + Uint16 mX, mY; /**< Tile coordinates */ + Uint8 mDirection; /**< Facing direction */ + Uint8 mAction; Uint8 mFrame; - Sint32 speech_color; - Uint16 walk_time; - Uint8 emotion; /**< Currently showing emotion */ - Uint8 emotion_time; /**< Time until emotion disappears */ + Sint32 mSpeechColor; + Uint16 mWalkTime; + Uint8 mEmotion; /**< Currently showing emotion */ + Uint8 mEmotionTime; /**< Time until emotion disappears */ - Uint16 aspd; /**< Attack speed */ + Uint16 mAttackSpeed; /**< Attack speed */ /** * Constructor. @@ -155,7 +155,7 @@ class Being : public Sprite * Gets the hair color for this being. */ Uint16 - getHairColor() const { return hairColor; } + getHairColor() const { return mHairColor; } /** * Sets the hair style for this being. @@ -167,7 +167,7 @@ class Being : public Sprite * Gets the hair style for this being. */ Uint16 - getHairStyle() const { return hairStyle; } + getHairStyle() const { return mHairStyle; } /** * Makes this being take the next step of his path. @@ -309,12 +309,12 @@ class Being : public Sprite SpriteIterator mSpriteIterator; Path mPath; - std::string speech; - std::string damage; - Uint16 hairStyle, hairColor; - Uint32 speech_time; - Uint32 damage_time; - bool showSpeech, showDamage; + std::string mSpeech; + std::string mDamage; + Uint16 mHairStyle, mHairColor; + Uint32 mSpeechTime; + Uint32 mDamageTime; + bool mShowSpeech, mShowDamage; Sint32 mPx, mPy; /**< Pixel coordinates */ Spriteset *mSpriteset; diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index c5890048..10123d06 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -39,8 +39,9 @@ class FindBeingFunctor bool operator() (Being *being) { Uint16 other_y = y + ((being->getType() == Being::NPC) ? 1 : 0); - return (being->x == x && (being->y == y || being->y == other_y) && - being->action != Being::MONSTER_DEAD && + return (being->mX == x && + (being->mY == y || being->mY == other_y) && + being->mAction != Being::MONSTER_DEAD && (type == Being::UNKNOWN || being->getType() == type)); } @@ -132,7 +133,7 @@ void BeingManager::logic() being->logic(); - if (being->action == Being::MONSTER_DEAD && being->mFrame >= 20) + if (being->mAction == Being::MONSTER_DEAD && being->mFrame >= 20) { delete being; i = mBeings.erase(i); diff --git a/src/engine.cpp b/src/engine.cpp index 2cf0fc87..43d4d0e5 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -180,8 +180,8 @@ void Engine::draw(Graphics *graphics) int midTileX = graphics->getWidth() / 32 / 2; int midTileY = graphics->getHeight() / 32 / 2; - int map_x = (player_node->x - midTileX) * 32 + player_node->getXOffset(); - int map_y = (player_node->y - midTileY) * 32 + player_node->getYOffset(); + int map_x = (player_node->mX - midTileX) * 32 + player_node->getXOffset(); + int map_y = (player_node->mY - midTileY) * 32 + player_node->getYOffset(); if (mCurrentMap) { if (map_x < 0) { @@ -221,7 +221,7 @@ void Engine::draw(Graphics *graphics) int mouseTileY = mouseY / 32 + camera_y; Path debugPath = mCurrentMap->findPath( - player_node->x, player_node->y, + player_node->mX, player_node->mY, mouseTileX, mouseTileY); for (PathIterator i = debugPath.begin(); i != debugPath.end(); i++) diff --git a/src/game.cpp b/src/game.cpp index 10d87d12..497cc903 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -461,20 +461,20 @@ void Game::handleInput() if (!chatWindow->isFocused()) { FloorItem *item = floorItemManager->findByCoordinates( - player_node->x, player_node->y); + player_node->mX, player_node->mY); // If none below the player, try the tile in front of // the player if (!item) { - Uint16 x = player_node->x; - Uint16 y = player_node->y; - if (player_node->direction & Being::UP) + Uint16 x = player_node->mX; + Uint16 y = player_node->mY; + if (player_node->mDirection & Being::UP) y--; - if (player_node->direction & Being::DOWN) + if (player_node->mDirection & Being::DOWN) y++; - if (player_node->direction & Being::LEFT) + if (player_node->mDirection & Being::LEFT) x--; - if (player_node->direction & Being::RIGHT) + if (player_node->mDirection & Being::RIGHT) x++; item = floorItemManager->findByCoordinates(x, y); @@ -585,12 +585,12 @@ void Game::handleInput() } // End while // Moving player around - if (player_node->action != Being::DEAD && + if (player_node->mAction != Being::DEAD && current_npc == 0 && !chatWindow->isFocused()) { - Uint16 x = player_node->x; - Uint16 y = player_node->y; + Uint16 x = player_node->mX; + Uint16 y = player_node->mY; unsigned char Direction = 0; // Translate pressed keys to movement and direction @@ -633,13 +633,13 @@ void Game::handleInput() { Uint16 targetX = x, targetY = y; - if (player_node->direction & Being::UP) + if (player_node->mDirection & Being::UP) targetY--; - if (player_node->direction & Being::DOWN) + if (player_node->mDirection & Being::DOWN) targetY++; - if (player_node->direction & Being::LEFT) + if (player_node->mDirection & Being::LEFT) targetX--; - if (player_node->direction & Being::RIGHT) + if (player_node->mDirection & Being::RIGHT) targetX++; // Attack priorioty is: Monster, Player, auto target @@ -658,7 +658,7 @@ void Game::handleInput() if (joystick->buttonPressed(1)) { FloorItem *item = floorItemManager->findByCoordinates( - player_node->x, player_node->y); + player_node->mX, player_node->mY); if (item) player_node->pickUp(item); diff --git a/src/graphics.cpp b/src/graphics.cpp index 0a66bb66..3f6a98c6 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -122,7 +122,7 @@ int Graphics::getHeight() bool Graphics::drawImage(Image *image, int x, int y) { - return drawImage(image, 0, 0, x, y, image->bounds.w, image->bounds.h); + return drawImage(image, 0, 0, x, y, image->mBounds.w, image->mBounds.h); } bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, @@ -131,8 +131,8 @@ bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, dstX += mClipStack.top().xOffset; dstY += mClipStack.top().yOffset; - srcX += image->bounds.x; - srcY += image->bounds.y; + srcX += image->mBounds.x; + srcY += image->mBounds.y; // Check that preconditions for blitting are met. if (!mScreen || !image->mImage) return false; 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 */ diff --git a/src/localplayer.cpp b/src/localplayer.cpp index cb648f63..d418ac7d 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -51,9 +51,9 @@ LocalPlayer::~LocalPlayer() void LocalPlayer::logic() { - switch (action) { + switch (mAction) { case WALK: - mFrame = (get_elapsed_time(walk_time) * 6) / mWalkSpeed; + mFrame = (get_elapsed_time(mWalkTime) * 6) / mWalkSpeed; if (mFrame >= 6) { nextStep(); } @@ -65,7 +65,7 @@ void LocalPlayer::logic() { frames = 5; } - mFrame = (get_elapsed_time(walk_time) * frames) / aspd; + mFrame = (get_elapsed_time(mWalkTime) * frames) / mAttackSpeed; if (mFrame >= frames) { nextStep(); attack(); @@ -155,8 +155,8 @@ void LocalPlayer::dropItem(Item *item, int quantity) void LocalPlayer::pickUp(FloorItem *item) { - int dx = item->getX() - x; - int dy = item->getY() - y; + int dx = item->getX() - mX; + int dy = item->getY() - mY; if (dx * dx + dy * dy < 4) { MessageOut outMsg(mNetwork); @@ -175,10 +175,10 @@ void LocalPlayer::walk(unsigned char dir) if (!mMap || !dir) return; - if (action == WALK) + if (mAction == WALK) { // Just finish the current action, otherwise we get out of sync - Being::setDestination(x, y); + Being::setDestination(mX, mY); return; } @@ -193,25 +193,25 @@ void LocalPlayer::walk(unsigned char dir) dx++; // Prevent skipping corners over colliding tiles - if (dx && mMap->tileCollides(x + dx, y)) + if (dx && mMap->tileCollides(mX + dx, mY)) dx = 0; - if (dy && mMap->tileCollides(x, y + dy)) + if (dy && mMap->tileCollides(mX, mY + dy)) dy = 0; // Choose a straight direction when diagonal target is blocked - if (dx && dy && !mMap->getWalk(x + dx, y + dy)) + if (dx && dy && !mMap->getWalk(mX + dx, mY + dy)) dx = 0; // Walk to where the player can actually go - if ((dx || dy) && mMap->getWalk(x + dx, y + dy)) + if ((dx || dy) && mMap->getWalk(mX + dx, mY + dy)) { - setDestination(x + dx, y + dy); + setDestination(mX + dx, mY + dy); } else if (dir) { // Update the player direction to where he wants to walk // Warning: Not communicated to the server yet - direction = dir; + mDirection = dir; } } @@ -219,7 +219,7 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y) { char temp[3]; MessageOut outMsg(mNetwork); - set_coordinates(temp, x, y, direction); + set_coordinates(temp, mX, mY, mDirection); outMsg.writeInt16(0x0085); outMsg.writeString(temp, 3); @@ -264,7 +264,7 @@ void LocalPlayer::raiseAttribute(Attribute attr) void LocalPlayer::raiseSkill(Uint16 skillId) { - if (skillPoint <= 0) + if (mSkillPoint <= 0) return; MessageOut outMsg(mNetwork); @@ -279,7 +279,7 @@ void LocalPlayer::toggleSit() mLastAction = tick_time; char type; - switch (action) + switch (mAction) { case STAND: type = 2; break; case SIT: type = 3; break; @@ -328,7 +328,7 @@ bool LocalPlayer::tradeRequestOk() const void LocalPlayer::attack(Being *target, bool keep) { // Can only attack when standing still - if (action != STAND) + if (mAction != STAND) return; if (keep && target) @@ -339,29 +339,29 @@ void LocalPlayer::attack(Being *target, bool keep) if (!target) return; - int dist_x = target->x - x; - int dist_y = target->y - y; + int dist_x = target->mX - mX; + int dist_y = target->mY - mY; if (abs(dist_y) >= abs(dist_x)) { if (dist_y > 0) - direction = DOWN; + mDirection = DOWN; else - direction = UP; + mDirection = UP; } else { if (dist_x > 0) - direction = RIGHT; + mDirection = RIGHT; else - direction = LEFT; + mDirection = LEFT; } // Implement charging attacks here - lastAttackTime = 0; + mLastAttackTime = 0; - action = ATTACK; - walk_time = tick_time; + mAction = ATTACK; + mWalkTime = tick_time; if (getWeapon() == 2) sound.playSfx("sfx/bow_shoot_1.ogg"); else diff --git a/src/localplayer.h b/src/localplayer.h index cd4809fb..38e05f4f 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -123,25 +123,25 @@ class LocalPlayer : public Player Uint32 mCharId; - Uint32 xp, jobXp; - Uint16 lvl; - Uint32 jobLvl; - Uint32 xpForNextLevel, jobXpForNextLevel; - Uint16 hp, maxHp, mp, maxMp; - Uint32 gp; + Uint32 mXp, mJobXp; + Uint16 mLevel; + Uint32 mJobLevel; + Uint32 mXpForNextLevel, mJobXpForNextLevel; + Uint16 mHp, mMaxHp, mMp, mMaxMp; + Uint32 mGp; - Uint32 totalWeight, maxWeight; + Uint32 mTotalWeight, mMaxWeight; - Uint8 ATTR[6]; - Uint8 ATTR_UP[6]; + Uint8 mAttr[6]; + Uint8 mAttrUp[6]; Sint16 ATK, MATK, DEF, MDEF, HIT, FLEE; Sint16 ATK_BONUS, MATK_BONUS, DEF_BONUS, MDEF_BONUS, FLEE_BONUS; - Uint16 statPoint, skillPoint; - Uint16 statsPointsToAttribute; + Uint16 mStatPoint, mSkillPoint; + Uint16 mStatsPointsToAttribute; - float lastAttackTime; /**< Used to synchronize the charge dialog */ + float mLastAttackTime; /**< Used to synchronize the charge dialog */ std::auto_ptr<Inventory> mInventory; std::auto_ptr<Equipment> mEquipment; diff --git a/src/log.cpp b/src/log.cpp index 78db9eff..d2f1e125 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -34,17 +34,17 @@ Logger::~Logger() { - if (logFile.is_open()) + if (mLogFile.is_open()) { - logFile.close(); + mLogFile.close(); } } void Logger::setLogFile(const std::string &logFilename) { - logFile.open(logFilename.c_str(), std::ios_base::trunc); + mLogFile.open(logFilename.c_str(), std::ios_base::trunc); - if (!logFile.is_open()) + if (!mLogFile.is_open()) { std::cout << "Warning: error while opening " << logFilename << " for writing.\n"; @@ -53,7 +53,7 @@ void Logger::setLogFile(const std::string &logFilename) void Logger::log(const char *log_text, ...) { - if (!logFile.is_open()) { + if (!mLogFile.is_open()) { return; } @@ -82,7 +82,7 @@ void Logger::log(const char *log_text, ...) timeStr << (int)(t % 60); timeStr << "] "; - logFile << timeStr.str() << buf << std::endl; + mLogFile << timeStr.str() << buf << std::endl; // Delete temporary buffer delete[] buf; @@ -53,7 +53,7 @@ class Logger void error(const std::string &error_text); private: - std::ofstream logFile; + std::ofstream mLogFile; }; extern Logger *logger; diff --git a/src/map.cpp b/src/map.cpp index c66a85c9..531b0f15 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -60,20 +60,20 @@ struct Location Map::Map(int width, int height, int tileWidth, int tileHeight): mWidth(width), mHeight(height), mTileWidth(tileWidth), mTileHeight(tileHeight), - onClosedList(1), onOpenList(2) + mOnClosedList(1), mOnOpenList(2) { - metaTiles = new MetaTile[mWidth * mHeight]; - tiles = new Image*[mWidth * mHeight * 3]; + mMetaTiles = new MetaTile[mWidth * mHeight]; + mTiles = new Image*[mWidth * mHeight * 3]; } Map::~Map() { - delete[] metaTiles; - delete[] tiles; + delete[] mMetaTiles; + delete[] mTiles; // Clean up tilesets - for_each(tilesets.begin(), tilesets.end(), make_dtor(tilesets)); - tilesets.clear(); + for_each(mTilesets.begin(), mTilesets.end(), make_dtor(mTilesets)); + mTilesets.clear(); } void @@ -81,16 +81,16 @@ Map::setSize(int width, int height) { mWidth = width; mHeight = height; - delete[] metaTiles; - delete[] tiles; - metaTiles = new MetaTile[mWidth * mHeight]; - tiles = new Image*[mWidth * mHeight * 3]; + delete[] mMetaTiles; + delete[] mTiles; + mMetaTiles = new MetaTile[mWidth * mHeight]; + mTiles = new Image*[mWidth * mHeight * 3]; } void Map::addTileset(Tileset *tileset) { - tilesets.push_back(tileset); + mTilesets.push_back(tileset); } bool spriteCompare(const Sprite *a, const Sprite *b) @@ -189,9 +189,10 @@ Map::getTilesetWithGid(int gid) { containsGid.gid = gid; - TilesetIterator i = find_if(tilesets.begin(), tilesets.end(), containsGid); + TilesetIterator i = find_if(mTilesets.begin(), mTilesets.end(), + containsGid); - return (i == tilesets.end()) ? NULL : *i; + return (i == mTilesets.end()) ? NULL : *i; } Image* @@ -209,7 +210,7 @@ Map::getTileWithGid(int gid) void Map::setWalk(int x, int y, bool walkable) { - metaTiles[x + y * mWidth].walkable = walkable; + mMetaTiles[x + y * mWidth].walkable = walkable; } bool @@ -224,7 +225,7 @@ Map::getWalk(int x, int y) Beings *beings = beingManager->getAll(); for (BeingIterator i = beings->begin(); i != beings->end(); i++) { // job 45 is a portal, they don't collide - if ((*i)->x == x && (*i)->y == y && (*i)->job != 45) { + if ((*i)->mX == x && (*i)->mY == y && (*i)->mJob != 45) { return false; } } @@ -241,25 +242,25 @@ Map::tileCollides(int x, int y) } // Check if the tile is walkable - return !metaTiles[x + y * mWidth].walkable; + return !mMetaTiles[x + y * mWidth].walkable; } void Map::setTile(int x, int y, int layer, Image *img) { - tiles[x + y * mWidth + layer * (mWidth * mHeight)] = img; + mTiles[x + y * mWidth + layer * (mWidth * mHeight)] = img; } Image* Map::getTile(int x, int y, int layer) { - return tiles[x + y * mWidth + layer * (mWidth * mHeight)]; + return mTiles[x + y * mWidth + layer * (mWidth * mHeight)]; } MetaTile* Map::getMetaTile(int x, int y) { - return &metaTiles[x + y * mWidth]; + return &mMetaTiles[x + y * mWidth]; } SpriteIterator @@ -305,13 +306,13 @@ Map::findPath(int startX, int startY, int destX, int destY) // If the tile is already on the closed list, this means it has already // been processed with a shorter path to the start point (lower G cost) - if (curr.tile->whichList == onClosedList) + if (curr.tile->whichList == mOnClosedList) { continue; } // Put the current tile on the closed list - curr.tile->whichList = onClosedList; + curr.tile->whichList = mOnClosedList; // Check the adjacent tiles for (int dy = -1; dy <= 1; dy++) @@ -333,7 +334,7 @@ Map::findPath(int startX, int startY, int destX, int destY) MetaTile *newTile = getMetaTile(x, y); // Skip if the tile is on the closed list or is not walkable - if (newTile->whichList == onClosedList || !getWalk(x, y)) + if (newTile->whichList == mOnClosedList || !getWalk(x, y)) { continue; } @@ -363,7 +364,7 @@ Map::findPath(int startX, int startY, int destX, int destY) continue; } - if (newTile->whichList != onOpenList) + if (newTile->whichList != mOnOpenList) { // Found a new tile (not on open nor on closed list) // Update Hcost of the new tile using Manhatten distance @@ -379,7 +380,7 @@ Map::findPath(int startX, int startY, int destX, int destY) if (x != destX || y != destY) { // Add this tile to the open list - newTile->whichList = onOpenList; + newTile->whichList = mOnOpenList; openList.push(Location(x, y, newTile)); } else { @@ -408,8 +409,8 @@ Map::findPath(int startX, int startY, int destX, int destY) // Two new values to indicate whether a tile is on the open or closed list, // this way we don't have to clear all the values between each pathfinding. - onClosedList += 2; - onOpenList += 2; + mOnClosedList += 2; + mOnOpenList += 2; // If a path has been found, iterate backwards using the parent locations // to extract it. @@ -190,14 +190,14 @@ class Map : public Properties int mWidth, mHeight; int mTileWidth, mTileHeight; - MetaTile *metaTiles; - Image **tiles; + MetaTile *mMetaTiles; + Image **mTiles; - Tilesets tilesets; + Tilesets mTilesets; Sprites mSprites; // Pathfinding members - int onClosedList, onOpenList; + int mOnClosedList, mOnOpenList; }; #endif diff --git a/src/monster.cpp b/src/monster.cpp index 299940c5..6416c716 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -57,11 +57,11 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map): void Monster::logic() { - if (action != STAND) + if (mAction != STAND) { - mFrame = (get_elapsed_time(walk_time) * 4) / mWalkSpeed; + mFrame = (get_elapsed_time(mWalkTime) * 4) / mWalkSpeed; - if (mFrame >= 4 && action != MONSTER_DEAD) + if (mFrame >= 4 && mAction != MONSTER_DEAD) { nextStep(); } @@ -82,13 +82,13 @@ void Monster::draw(Graphics *graphics, int offsetX, int offsetY) mFrame = 3; } - mSpriteFrame = action; - if (action != MONSTER_DEAD) { + mSpriteFrame = mAction; + if (mAction != MONSTER_DEAD) { mSpriteFrame += mFrame; } unsigned char dir = 0; - while (!(direction & (1 << dir))) dir++; + while (!(mDirection & (1 << dir))) dir++; mSpriteFrame = dir + 4 * mSpriteFrame; diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index a01122d1..e95f785e 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -95,15 +95,15 @@ void BeingHandler::handleMessage(MessageIn *msg) { dstBeing->clearPath(); dstBeing->mFrame = 0; - dstBeing->walk_time = tick_time; - dstBeing->action = Being::STAND; + dstBeing->mWalkTime = tick_time; + dstBeing->mAction = Being::STAND; } // Prevent division by 0 when calculating frame if (speed == 0) { speed = 150; } dstBeing->setWalkSpeed(speed); - dstBeing->job = job; + dstBeing->mJob = job; dstBeing->setHairStyle(msg->readInt16()); dstBeing->setWeapon(msg->readInt16()); msg->readInt16(); // head option bottom @@ -131,15 +131,15 @@ void BeingHandler::handleMessage(MessageIn *msg) { Uint16 srcX, srcY, dstX, dstY; msg->readCoordinatePair(srcX, srcY, dstX, dstY); - dstBeing->action = Being::STAND; - dstBeing->x = srcX; - dstBeing->y = srcY; + dstBeing->mAction = Being::STAND; + dstBeing->mX = srcX; + dstBeing->mY = srcY; dstBeing->setDestination(dstX, dstY); } else { - msg->readCoordinates(dstBeing->x, dstBeing->y, - dstBeing->direction); + msg->readCoordinates(dstBeing->mX, dstBeing->mY, + dstBeing->mDirection); } msg->readInt8(); // unknown @@ -160,13 +160,13 @@ void BeingHandler::handleMessage(MessageIn *msg) switch (dstBeing->getType()) { case Being::MONSTER: - dstBeing->action = Being::MONSTER_DEAD; + dstBeing->mAction = Being::MONSTER_DEAD; dstBeing->mFrame = 0; - dstBeing->walk_time = tick_time; + dstBeing->mWalkTime = tick_time; break; default: - dstBeing->action = Being::DEAD; + dstBeing->mAction = Being::DEAD; break; } } @@ -205,27 +205,27 @@ void BeingHandler::handleMessage(MessageIn *msg) // buggy if (srcBeing->getType() == Being::MONSTER) { - srcBeing->action = Being::MONSTER_ATTACK; + srcBeing->mAction = Being::MONSTER_ATTACK; } else { - srcBeing->action = Being::ATTACK; + srcBeing->mAction = Being::ATTACK; } srcBeing->mFrame = 0; - srcBeing->walk_time = tick_time; + srcBeing->mWalkTime = tick_time; } break; case 2: // Sit if (srcBeing == NULL) break; srcBeing->mFrame = 0; - srcBeing->action = Being::SIT; + srcBeing->mAction = Being::SIT; break; case 3: // Stand up if (srcBeing == NULL) break; srcBeing->mFrame = 0; - srcBeing->action = Being::STAND; + srcBeing->mAction = Being::STAND; break; } break; @@ -246,8 +246,8 @@ void BeingHandler::handleMessage(MessageIn *msg) break; } - dstBeing->emotion = msg->readInt8(); - dstBeing->emotion_time = EMOTION_TIME; + dstBeing->mEmotion = msg->readInt8(); + dstBeing->mEmotionTime = EMOTION_TIME; break; case SMSG_BEING_CHANGE_LOOKS: @@ -298,7 +298,7 @@ void BeingHandler::handleMessage(MessageIn *msg) } dstBeing->setWalkSpeed(speed); - dstBeing->job = job; + dstBeing->mJob = job; dstBeing->setHairStyle(msg->readInt16()); dstBeing->setWeaponById(msg->readInt16()); // item id 1 msg->readInt16(); // item id 2 @@ -324,14 +324,14 @@ void BeingHandler::handleMessage(MessageIn *msg) { Uint16 srcX, srcY, dstX, dstY; msg->readCoordinatePair(srcX, srcY, dstX, dstY); - dstBeing->x = srcX; - dstBeing->y = srcY; + dstBeing->mX = srcX; + dstBeing->mY = srcY; dstBeing->setDestination(dstX, dstY); } else { - msg->readCoordinates(dstBeing->x, dstBeing->y, - dstBeing->direction); + msg->readCoordinates(dstBeing->mX, dstBeing->mY, + dstBeing->mDirection); } msg->readInt8(); // unknown @@ -341,7 +341,7 @@ void BeingHandler::handleMessage(MessageIn *msg) { if (msg->readInt8() == 2) { - dstBeing->action = Being::SIT; + dstBeing->mAction = Being::SIT; } } else if (msg->getId() == SMSG_PLAYER_MOVE) @@ -352,7 +352,7 @@ void BeingHandler::handleMessage(MessageIn *msg) msg->readInt8(); // Lv msg->readInt8(); // unknown - dstBeing->walk_time = tick_time; + dstBeing->mWalkTime = tick_time; dstBeing->mFrame = 0; break; diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp index 501762ad..b10c7ab9 100644 --- a/src/net/buysellhandler.cpp +++ b/src/net/buysellhandler.cpp @@ -72,7 +72,7 @@ void BuySellHandler::handleMessage(MessageIn *msg) msg->readInt16(); // length n_items = (msg->getLength() - 4) / 11; buyDialog->reset(); - buyDialog->setMoney(player_node->gp); + buyDialog->setMoney(player_node->mGp); buyDialog->setVisible(true); for (int k = 0; k < n_items; k++) diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index 015c9d94..55bfa0c6 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -165,22 +165,22 @@ LocalPlayer* CharServerHandler::readPlayerData(MessageIn *msg, int &slot) LocalPlayer *tempPlayer = new LocalPlayer(mLoginData->account_ID, 0, NULL); tempPlayer->mCharId = msg->readInt32(); - tempPlayer->totalWeight = 0; - tempPlayer->maxWeight = 0; - tempPlayer->lastAttackTime = 0; - tempPlayer->xp = msg->readInt32(); - tempPlayer->gp = msg->readInt32(); - tempPlayer->jobXp = msg->readInt32(); - tempPlayer->jobLvl = msg->readInt32(); + tempPlayer->mTotalWeight = 0; + tempPlayer->mMaxWeight = 0; + tempPlayer->mLastAttackTime = 0; + tempPlayer->mXp = msg->readInt32(); + tempPlayer->mGp = msg->readInt32(); + tempPlayer->mJobXp = msg->readInt32(); + tempPlayer->mJobLevel = msg->readInt32(); msg->skip(8); // unknown msg->readInt32(); // option msg->readInt32(); // karma msg->readInt32(); // manner msg->skip(2); // unknown - tempPlayer->hp = msg->readInt16(); - tempPlayer->maxHp = msg->readInt16(); - tempPlayer->mp = msg->readInt16(); - tempPlayer->maxMp = msg->readInt16(); + tempPlayer->mHp = msg->readInt16(); + tempPlayer->mMaxHp = msg->readInt16(); + tempPlayer->mMp = msg->readInt16(); + tempPlayer->mMaxMp = msg->readInt16(); msg->readInt16(); // speed msg->readInt16(); // class tempPlayer->setHairStyle(msg->readInt16()); @@ -188,7 +188,7 @@ LocalPlayer* CharServerHandler::readPlayerData(MessageIn *msg, int &slot) if (weapon == 11) weapon = 2; tempPlayer->setWeapon(weapon); - tempPlayer->lvl = msg->readInt16(); + tempPlayer->mLevel = msg->readInt16(); msg->readInt16(); // skill point msg->readInt16(); // head bottom msg->readInt16(); // shield @@ -198,7 +198,7 @@ LocalPlayer* CharServerHandler::readPlayerData(MessageIn *msg, int &slot) msg->readInt16(); // unknown tempPlayer->setName(msg->readString(24)); for (int i = 0; i < 6; i++) { - tempPlayer->ATTR[i] = msg->readInt8(); + tempPlayer->mAttr[i] = msg->readInt8(); } slot = msg->readInt8(); // character slot msg->readInt8(); // unknown diff --git a/src/net/maploginhandler.cpp b/src/net/maploginhandler.cpp index 27a7b4c6..0afc8357 100644 --- a/src/net/maploginhandler.cpp +++ b/src/net/maploginhandler.cpp @@ -48,10 +48,10 @@ void MapLoginHandler::handleMessage(MessageIn *msg) { case SMSG_LOGIN_SUCCESS: msg->readInt32(); // server tick - msg->readCoordinates(player_node->x, player_node->y, direction); + msg->readCoordinates(player_node->mX, player_node->mY, direction); msg->skip(2); // unknown logger->log("Protocol: Player start position: (%d, %d), Direction: %d", - player_node->x, player_node->y, direction); + player_node->mX, player_node->mY, direction); state = GAME_STATE; break; diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp index 7bf97b5f..02afc9db 100644 --- a/src/net/playerhandler.cpp +++ b/src/net/playerhandler.cpp @@ -106,11 +106,11 @@ void PlayerHandler::handleMessage(MessageIn *msg) current_npc = 0; - player_node->action = Being::STAND; + player_node->mAction = Being::STAND; player_node->stopAttack(); player_node->mFrame = 0; - player_node->x = x; - player_node->y = y; + player_node->mX = x; + player_node->mY = y; } break; @@ -124,19 +124,19 @@ void PlayerHandler::handleMessage(MessageIn *msg) //case 0x0000: // player_node->setWalkSpeed(msg->readInt32()); // break; - case 0x0005: player_node->hp = value; break; - case 0x0006: player_node->maxHp = value; break; - case 0x0007: player_node->mp = value; break; - case 0x0008: player_node->maxMp = value; break; - case 0x000b: player_node->lvl = value; break; + case 0x0005: player_node->mHp = value; break; + case 0x0006: player_node->mMaxHp = value; break; + case 0x0007: player_node->mMp = value; break; + case 0x0008: player_node->mMaxMp = value; break; + case 0x000b: player_node->mLevel = value; break; case 0x000c: - player_node->skillPoint = value; + player_node->mSkillPoint = value; skillDialog->update(); break; case 0x0018: - if (value >= player_node->maxWeight / 2 && - player_node->totalWeight < - player_node->maxWeight / 2) + if (value >= player_node->mMaxWeight / 2 && + player_node->mTotalWeight < + player_node->mMaxWeight / 2) { weightNotice = new OkDialog("Message", "You are carrying more then half your " @@ -144,12 +144,12 @@ void PlayerHandler::handleMessage(MessageIn *msg) "health."); weightNotice->addActionListener(&weightNoticeListener); } - player_node->totalWeight = value; + player_node->mTotalWeight = value; break; - case 0x0019: player_node->maxWeight = value; break; - case 0x0037: player_node->jobLvl = value; break; + case 0x0019: player_node->mMaxWeight = value; break; + case 0x0037: player_node->mJobLevel = value; break; case 0x0009: - player_node->statsPointsToAttribute = value; + player_node->mStatsPointsToAttribute = value; break; case 0x0029: player_node->ATK = value; break; case 0x002b: player_node->MATK = value; break; @@ -157,15 +157,15 @@ void PlayerHandler::handleMessage(MessageIn *msg) case 0x002f: player_node->MDEF = value; break; case 0x0031: player_node->HIT = value; break; case 0x0032: player_node->FLEE = value; break; - case 0x0035: player_node->aspd = value; break; + case 0x0035: player_node->mAttackSpeed = value; break; } - if (player_node->hp == 0 && deathNotice == NULL) + if (player_node->mHp == 0 && deathNotice == NULL) { deathNotice = new OkDialog("Message", "You're now dead, press ok to restart"); deathNotice->addActionListener(&deathNoticeListener); - player_node->action = Being::DEAD; + player_node->mAction = Being::DEAD; } } break; @@ -173,19 +173,19 @@ void PlayerHandler::handleMessage(MessageIn *msg) case SMSG_PLAYER_STAT_UPDATE_2: switch (msg->readInt16()) { case 0x0001: - player_node->xp = msg->readInt32(); + player_node->mXp = msg->readInt32(); break; case 0x0002: - player_node->jobXp = msg->readInt32(); + player_node->mJobXp = msg->readInt32(); break; case 0x0014: - player_node->gp = msg->readInt32(); + player_node->mGp = msg->readInt32(); break; case 0x0016: - player_node->xpForNextLevel = msg->readInt32(); + player_node->mXpForNextLevel = msg->readInt32(); break; case 0x0017: - player_node->jobXpForNextLevel = msg->readInt32(); + player_node->mJobXpForNextLevel = msg->readInt32(); break; } break; @@ -198,12 +198,18 @@ void PlayerHandler::handleMessage(MessageIn *msg) Sint32 total = base + bonus; switch (type) { - case 0x000d: player_node->ATTR[LocalPlayer::STR] = total; break; - case 0x000e: player_node->ATTR[LocalPlayer::AGI] = total; break; - case 0x000f: player_node->ATTR[LocalPlayer::VIT] = total; break; - case 0x0010: player_node->ATTR[LocalPlayer::INT] = total; break; - case 0x0011: player_node->ATTR[LocalPlayer::DEX] = total; break; - case 0x0012: player_node->ATTR[LocalPlayer::LUK] = total; break; + case 0x000d: player_node->mAttr[LocalPlayer::STR] = total; + break; + case 0x000e: player_node->mAttr[LocalPlayer::AGI] = total; + break; + case 0x000f: player_node->mAttr[LocalPlayer::VIT] = total; + break; + case 0x0010: player_node->mAttr[LocalPlayer::INT] = total; + break; + case 0x0011: player_node->mAttr[LocalPlayer::DEX] = total; + break; + case 0x0012: player_node->mAttr[LocalPlayer::LUK] = total; + break; } } break; @@ -214,35 +220,41 @@ void PlayerHandler::handleMessage(MessageIn *msg) Sint8 fail = msg->readInt8(); Sint8 value = msg->readInt8(); - if (fail == 1) - { - switch (type) { - case 0x000d: player_node->ATTR[LocalPlayer::STR] = value; break; - case 0x000e: player_node->ATTR[LocalPlayer::AGI] = value; break; - case 0x000f: player_node->ATTR[LocalPlayer::VIT] = value; break; - case 0x0010: player_node->ATTR[LocalPlayer::INT] = value; break; - case 0x0011: player_node->ATTR[LocalPlayer::DEX] = value; break; - case 0x0012: player_node->ATTR[LocalPlayer::LUK] = value; break; - } + if (fail != 1) + break; + + switch (type) { + case 0x000d: player_node->mAttr[LocalPlayer::STR] = value; + break; + case 0x000e: player_node->mAttr[LocalPlayer::AGI] = value; + break; + case 0x000f: player_node->mAttr[LocalPlayer::VIT] = value; + break; + case 0x0010: player_node->mAttr[LocalPlayer::INT] = value; + break; + case 0x0011: player_node->mAttr[LocalPlayer::DEX] = value; + break; + case 0x0012: player_node->mAttr[LocalPlayer::LUK] = value; + break; } } break; // Updates stats and status points case SMSG_PLAYER_STAT_UPDATE_5: - player_node->statsPointsToAttribute = msg->readInt16(); - player_node->ATTR[LocalPlayer::STR] = msg->readInt8(); - player_node->ATTR_UP[LocalPlayer::STR] = msg->readInt8(); - player_node->ATTR[LocalPlayer::AGI] = msg->readInt8(); - player_node->ATTR_UP[LocalPlayer::AGI] = msg->readInt8(); - player_node->ATTR[LocalPlayer::VIT] = msg->readInt8(); - player_node->ATTR_UP[LocalPlayer::VIT] = msg->readInt8(); - player_node->ATTR[LocalPlayer::INT] = msg->readInt8(); - player_node->ATTR_UP[LocalPlayer::INT] = msg->readInt8(); - player_node->ATTR[LocalPlayer::DEX] = msg->readInt8(); - player_node->ATTR_UP[LocalPlayer::DEX] = msg->readInt8(); - player_node->ATTR[LocalPlayer::LUK] = msg->readInt8(); - player_node->ATTR_UP[LocalPlayer::LUK] = msg->readInt8(); + player_node->mStatsPointsToAttribute = msg->readInt16(); + player_node->mAttr[LocalPlayer::STR] = msg->readInt8(); + player_node->mAttrUp[LocalPlayer::STR] = msg->readInt8(); + player_node->mAttr[LocalPlayer::AGI] = msg->readInt8(); + player_node->mAttrUp[LocalPlayer::AGI] = msg->readInt8(); + player_node->mAttr[LocalPlayer::VIT] = msg->readInt8(); + player_node->mAttrUp[LocalPlayer::VIT] = msg->readInt8(); + player_node->mAttr[LocalPlayer::INT] = msg->readInt8(); + player_node->mAttrUp[LocalPlayer::INT] = msg->readInt8(); + player_node->mAttr[LocalPlayer::DEX] = msg->readInt8(); + player_node->mAttrUp[LocalPlayer::DEX] = msg->readInt8(); + player_node->mAttr[LocalPlayer::LUK] = msg->readInt8(); + player_node->mAttrUp[LocalPlayer::LUK] = msg->readInt8(); player_node->ATK = msg->readInt16(); // ATK player_node->ATK_BONUS = msg->readInt16(); // ATK bonus player_node->MATK = msg->readInt16(); // MATK max @@ -260,12 +272,24 @@ void PlayerHandler::handleMessage(MessageIn *msg) case SMSG_PLAYER_STAT_UPDATE_6: switch (msg->readInt16()) { - case 0x0020: player_node->ATTR_UP[LocalPlayer::STR] = msg->readInt8(); break; - case 0x0021: player_node->ATTR_UP[LocalPlayer::AGI] = msg->readInt8(); break; - case 0x0022: player_node->ATTR_UP[LocalPlayer::VIT] = msg->readInt8(); break; - case 0x0023: player_node->ATTR_UP[LocalPlayer::INT] = msg->readInt8(); break; - case 0x0024: player_node->ATTR_UP[LocalPlayer::DEX] = msg->readInt8(); break; - case 0x0025: player_node->ATTR_UP[LocalPlayer::LUK] = msg->readInt8(); break; + case 0x0020: + player_node->mAttrUp[LocalPlayer::STR] = msg->readInt8(); + break; + case 0x0021: + player_node->mAttrUp[LocalPlayer::AGI] = msg->readInt8(); + break; + case 0x0022: + player_node->mAttrUp[LocalPlayer::VIT] = msg->readInt8(); + break; + case 0x0023: + player_node->mAttrUp[LocalPlayer::INT] = msg->readInt8(); + break; + case 0x0024: + player_node->mAttrUp[LocalPlayer::DEX] = msg->readInt8(); + break; + case 0x0025: + player_node->mAttrUp[LocalPlayer::LUK] = msg->readInt8(); + break; } break; diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 5e2cb500..9de59f79 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -84,8 +84,8 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) bool OpenGLGraphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) { - srcX += image->bounds.x; - srcY += image->bounds.y; + srcX += image->mBounds.x; + srcY += image->mBounds.y; // Find OpenGL texture coordinates float texX1 = srcX / (float)image->mTexWidth; diff --git a/src/player.cpp b/src/player.cpp index 67110bd8..d13cd2f4 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -71,9 +71,9 @@ Player::Player(Uint32 id, Uint16 job, Map *map): void Player::logic() { - switch (action) { + switch (mAction) { case WALK: - mFrame = (get_elapsed_time(walk_time) * 6) / mWalkSpeed; + mFrame = (get_elapsed_time(mWalkTime) * 6) / mWalkSpeed; if (mFrame >= 6) { nextStep(); } @@ -85,7 +85,7 @@ void Player::logic() { frames = 5; } - mFrame = (get_elapsed_time(walk_time) * frames) / aspd; + mFrame = (get_elapsed_time(mWalkTime) * frames) / mAttackSpeed; if (mFrame >= frames) { nextStep(); } @@ -106,16 +106,16 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY) { int px = mPx + offsetX; int py = mPy + offsetY; - int frame = action; + int frame = mAction; - frame = action; + frame = mAction; - if (action != SIT && action != DEAD) + if (mAction != SIT && mAction != DEAD) { frame += mFrame; } - if (action == ATTACK && getWeapon() > 0) + if (mAction == ATTACK && getWeapon() > 0) { if (getWeapon() == 2) { @@ -124,12 +124,12 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY) } unsigned char dir = 0; - while (!(direction & (1 << dir))) dir++; + while (!(mDirection & (1 << dir))) dir++; graphics->drawImage(playerset->get(frame + 18 * dir), px - 16, py - 32); - if (getWeapon() != 0 && action == ATTACK) + if (getWeapon() != 0 && mAction == ATTACK) { int frames = 4; if (getWeapon() == 2) diff --git a/src/resources/buddylist.cpp b/src/resources/buddylist.cpp index e41327a5..9327ef60 100644 --- a/src/resources/buddylist.cpp +++ b/src/resources/buddylist.cpp @@ -30,34 +30,27 @@ BuddyList::BuddyList() { // Find saved buddy list file - filename = new std::string(std::string(config.getValue("homeDir", "") + "/buddy.txt")); + mFilename = config.getValue("homeDir", "") + "/buddy.txt"; // Load buddy from file loadFile(); } -BuddyList::~BuddyList() -{ - delete filename; -} - void BuddyList::loadFile() { - char *buddy; - // Open file - std::ifstream inputStream(filename->c_str(), std::ios::in); - if( !inputStream ) { + std::ifstream inputStream(mFilename.c_str(), std::ios::in); + if (!inputStream) { std::cerr << "Error opening input stream" << std::endl; return; } do { - buddy = (char *) calloc(LEN_MAX_USERNAME, sizeof(char)); + char *buddy = new char[LEN_MAX_USERNAME]; inputStream.getline(buddy, LEN_MAX_USERNAME); // Ugly ? - if(strcmp(buddy,"") != 0) buddylist.push_back(buddy); - free(buddy); + if(strcmp(buddy,"")) mBuddylist.push_back(buddy); + delete [] buddy; } while(!inputStream.eof()); // Read buddy and close file @@ -69,31 +62,29 @@ void BuddyList::saveFile() std::string str; // Open file - std::ofstream outputStream(filename->c_str(), std::ios::trunc); - if( !outputStream ) { + std::ofstream outputStream(mFilename.c_str(), std::ios::trunc); + if (!outputStream) { std::cerr << "Error opening output stream" << std::endl; return; } // Write buddy and close file - for (buddyit = buddylist.begin(); buddyit != buddylist.end(); buddyit++) + for (BuddyIterator i = mBuddylist.begin(); i != mBuddylist.end(); ++i) { - str = *buddyit; - outputStream << (const char*) str.c_str() << std::endl; + outputStream << (const char*) i->c_str() << std::endl; } outputStream.close(); } bool BuddyList::addBuddy(const std::string buddy) { - for (buddyit = buddylist.begin(); buddyit != buddylist.end(); buddyit++) + if (find(mBuddylist.begin(), mBuddylist.end(), buddy) != mBuddylist.end()) { - // Buddy already exist - if (*buddyit == buddy) return false; + return false; } // Buddy doesnt exist, add it - buddylist.push_back(buddy); + mBuddylist.push_back(buddy); // Save file saveFile(); @@ -103,37 +94,29 @@ bool BuddyList::addBuddy(const std::string buddy) bool BuddyList::removeBuddy(const std::string buddy) { - if (buddylist.size() > 0) { - for (buddyit = buddylist.begin(); buddyit != buddylist.end(); buddyit++) - { - // Buddy exist, remove it - if (*buddyit == buddy) { - buddylist.remove(buddy); - - // Save file - saveFile(); - return true; - } - } + BuddyIterator i = find(mBuddylist.begin(), mBuddylist.end(), buddy); + + if (i != mBuddylist.end()) { + mBuddylist.erase(i); + saveFile(); + return true; } - // Buddy doesnt exist return false; } int BuddyList::getNumberOfElements() { - return buddylist.size(); + return mBuddylist.size(); } std::string BuddyList::getElementAt(int number) { - if (number <= (int) buddylist.size() - 1) - { - buddyit = buddylist.begin(); - std::advance(buddyit, number); - return *buddyit; + if (number >= (int) mBuddylist.size()) { + return ""; } - return ""; + BuddyIterator i = mBuddylist.begin(); + std::advance(i, number); + return *i; } diff --git a/src/resources/buddylist.h b/src/resources/buddylist.h index df5d6247..3791a03a 100644 --- a/src/resources/buddylist.h +++ b/src/resources/buddylist.h @@ -24,8 +24,8 @@ #ifndef _TMW_BUDDYLIST_H #define _TMW_BUDDYLIST_H -#include <iosfwd> #include <list> +#include <string> #include <guichan/listmodel.hpp> @@ -39,7 +39,7 @@ class BuddyList : public gcn::ListModel { /** * Destructor */ - virtual ~BuddyList(); + virtual ~BuddyList() { } /** * Adds buddy to the list @@ -72,9 +72,10 @@ class BuddyList : public gcn::ListModel { */ void loadFile(); - std::list<std::string> buddylist; /**< Buddy list */ - std::list<std::string>::iterator buddyit; /**< Iterator */ - std::string *filename; /* File to work with */ + typedef std::list<std::string> Buddies; + typedef Buddies::iterator BuddyIterator; + Buddies mBuddylist; /**< Buddy list */ + std::string mFilename; /* File to work with */ }; #endif /* _TMW_BUDDYLIST_H */ diff --git a/src/resources/image.cpp b/src/resources/image.cpp index f5082c60..ee2736d4 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -35,10 +35,10 @@ Image::Image(const std::string &idPath, SDL_Surface *image): Resource(idPath), mImage(image), mAlpha(1.0f) { - bounds.x = 0; - bounds.y = 0; - bounds.w = mImage->w; - bounds.h = mImage->h; + mBounds.x = 0; + mBounds.y = 0; + mBounds.w = mImage->w; + mBounds.h = mImage->h; } #ifdef USE_OPENGL @@ -51,10 +51,10 @@ Image::Image(const std::string &idPath, GLuint glimage, int width, int height, mImage(0), mAlpha(1.0) { - bounds.x = 0; - bounds.y = 0; - bounds.w = width; - bounds.h = height; + mBounds.x = 0; + mBounds.y = 0; + mBounds.w = width; + mBounds.h = height; } #endif @@ -258,7 +258,7 @@ Image* Image::load(void *buffer, unsigned int bufferSize, void Image::unload() { - loaded = false; + mLoaded = false; if (!mImage) return; @@ -315,10 +315,10 @@ SubImage::SubImage(Image *parent, SDL_Surface *image, mParent->incRef(); // Set up the rectangle. - bounds.x = x; - bounds.y = y; - bounds.w = width; - bounds.h = height; + mBounds.x = x; + mBounds.y = y; + mBounds.w = width; + mBounds.h = height; } #ifdef USE_OPENGL @@ -330,10 +330,10 @@ SubImage::SubImage(Image *parent, GLuint image, mParent->incRef(); // Set up the rectangle. - bounds.x = x; - bounds.y = y; - bounds.w = width; - bounds.h = height; + mBounds.x = x; + mBounds.y = y; + mBounds.w = width; + mBounds.h = height; } #endif diff --git a/src/resources/image.h b/src/resources/image.h index 44142155..1f67fcae 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -70,14 +70,14 @@ class Image : public Resource * Returns the width of the image. */ virtual int - getWidth() const { return bounds.w; } + getWidth() const { return mBounds.w; } /** * Returns the height of the image. */ virtual int - getHeight() const { return bounds.h; } + getHeight() const { return mBounds.h; } /** * Creates a new image with the desired clipping rectangle. @@ -119,8 +119,8 @@ class Image : public Resource #endif Image(const std::string &idPath, SDL_Surface *image); - SDL_Rect bounds; - bool loaded; + SDL_Rect mBounds; + bool mLoaded; #ifdef USE_OPENGL GLuint mGLImage; diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp index 994f11b9..9f6607c1 100644 --- a/src/resources/itemmanager.cpp +++ b/src/resources/itemmanager.cpp @@ -38,8 +38,8 @@ ItemManager::ItemManager() { - unknown = new ItemInfo(); - unknown->setName("Unknown item"); + mUnknown = new ItemInfo(); + mUnknown->setName("Unknown item"); ResourceManager *resman = ResourceManager::getInstance(); int size; @@ -161,7 +161,7 @@ ItemManager::~ItemManager() } mItemInfos.clear(); - delete unknown; + delete mUnknown; } ItemInfo* @@ -169,5 +169,5 @@ ItemManager::getItemInfo(int id) { ItemInfoIterator i = mItemInfos.find(id); - return (i != mItemInfos.end()) ? i->second : unknown; + return (i != mItemInfos.end()) ? i->second : mUnknown; } diff --git a/src/resources/itemmanager.h b/src/resources/itemmanager.h index 5a571de2..06eee507 100644 --- a/src/resources/itemmanager.h +++ b/src/resources/itemmanager.h @@ -51,7 +51,7 @@ class ItemManager typedef std::map<int, ItemInfo*> ItemInfos; typedef ItemInfos::iterator ItemInfoIterator; ItemInfos mItemInfos; - ItemInfo *unknown; + ItemInfo *mUnknown; }; extern ItemManager *itemDb; diff --git a/src/sound.cpp b/src/sound.cpp index f4b2a3ed..8b012176 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -30,9 +30,9 @@ #include "resources/soundeffect.h" Sound::Sound(): - installed(false), - sfxVolume(100), - musicVolume(60) + mInstalled(false), + mSfxVolume(100), + mMusicVolume(60) { } @@ -43,7 +43,7 @@ Sound::~Sound() void Sound::init() { // Don't initialize sound engine twice - if (installed) return; + if (mInstalled) return; logger->log("Sound::init() Initializing sound..."); @@ -66,9 +66,9 @@ void Sound::init() info(); - music = NULL; + mMusic = NULL; - installed = true; + mInstalled = true; } void Sound::info() @@ -112,33 +112,33 @@ void Sound::info() void Sound::setMusicVolume(int volume) { - if (!installed) return; + if (!mInstalled) return; - musicVolume = volume; + mMusicVolume = volume; Mix_VolumeMusic(volume); } void Sound::setSfxVolume(int volume) { - if (!installed) return; + if (!mInstalled) return; - sfxVolume = volume; + mSfxVolume = volume; Mix_Volume(-1, volume); } void Sound::playMusic(const char *path, int loop) { - if (!installed) return; + if (!mInstalled) return; - if (music != NULL) { + if (mMusic != NULL) { stopMusic(); } logger->log("Sound::startMusic() Playing \"%s\" %i times", path, loop); - music = Mix_LoadMUS(path); - if (music) { - Mix_PlayMusic(music, loop); + mMusic = Mix_LoadMUS(path); + if (mMusic) { + Mix_PlayMusic(mMusic, loop); } else { logger->log("Sound::startMusic() Warning: error loading file."); @@ -147,31 +147,31 @@ void Sound::playMusic(const char *path, int loop) void Sound::stopMusic() { - if (!installed) return; + if (!mInstalled) return; logger->log("Sound::stopMusic()"); - if (music != NULL) { + if (mMusic != NULL) { Mix_HaltMusic(); - Mix_FreeMusic(music); - music = NULL; + Mix_FreeMusic(mMusic); + mMusic = NULL; } } void Sound::fadeInMusic(const char *path, int loop, int ms) { - if (!installed) return; + if (!mInstalled) return; - if (music != NULL) { + if (mMusic != NULL) { stopMusic(); } logger->log("Sound::fadeInMusic() Fading \"%s\" %i times (%i ms)", path, loop, ms); - music = Mix_LoadMUS(path); - if (music) { - Mix_FadeInMusic(music, loop, ms); + mMusic = Mix_LoadMUS(path); + if (mMusic) { + Mix_FadeInMusic(mMusic, loop, ms); } else { logger->log("Sound::fadeInMusic() Warning: error loading file."); @@ -180,20 +180,20 @@ void Sound::fadeInMusic(const char *path, int loop, int ms) void Sound::fadeOutMusic(int ms) { - if (!installed) return; + if (!mInstalled) return; logger->log("Sound::fadeOutMusic() Fading-out (%i ms)", ms); - if (music != NULL) { + if (mMusic != NULL) { Mix_FadeOutMusic(ms); - Mix_FreeMusic(music); - music = NULL; + Mix_FreeMusic(mMusic); + mMusic = NULL; } } void Sound::playSfx(const char *path) { - if (!installed) return; + if (!mInstalled) return; ResourceManager *resman = ResourceManager::getInstance(); SoundEffect *sample = resman->getSoundEffect(path); @@ -207,7 +207,7 @@ void Sound::close() { stopMusic(); - installed = false; + mInstalled = false; Mix_CloseAudio(); logger->log("Sound::close() Shutting down sound..."); } diff --git a/src/sound.h b/src/sound.h index 4379754f..421bf899 100644 --- a/src/sound.h +++ b/src/sound.h @@ -108,12 +108,12 @@ class Sound { void playSfx(const char *path); private: - bool installed; + bool mInstalled; - int sfxVolume; - int musicVolume; + int mSfxVolume; + int mMusicVolume; - Mix_Music *music; + Mix_Music *mMusic; }; extern Sound sound; |