diff options
author | Philipp Sehmisch <crush@themanaworld.org> | 2009-02-11 17:02:16 +0100 |
---|---|---|
committer | Philipp Sehmisch <crush@themanaworld.org> | 2009-02-11 17:02:16 +0100 |
commit | f262dbd28f08001d70416e3cc4e62273d3fee2cd (patch) | |
tree | 539cbc8b27edf696120df0ac26531640c323692f /src/gui | |
parent | d68f3fa13297cf4c8d29753e48c684496852ceba (diff) | |
parent | 63ac001daa7dfc0735dfefd9c2829c8786b4edaf (diff) | |
download | mana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.tar.gz mana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.tar.bz2 mana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.tar.xz mana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.zip |
Merge branch 'master' of git@gitorious.org:tmw/eathena
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/chat.cpp | 18 | ||||
-rw-r--r-- | src/gui/focushandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/inventorywindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 8 | ||||
-rw-r--r-- | src/gui/login.cpp | 10 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 2 | ||||
-rw-r--r-- | src/gui/playerbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 20 | ||||
-rw-r--r-- | src/gui/radiobutton.cpp | 2 | ||||
-rw-r--r-- | src/gui/recorder.cpp | 27 | ||||
-rw-r--r-- | src/gui/register.cpp | 4 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup_colors.cpp | 10 | ||||
-rw-r--r-- | src/gui/setup_colors.h | 2 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup_players.h | 5 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 4 | ||||
-rw-r--r-- | src/gui/shortcutwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/skill.cpp | 26 | ||||
-rw-r--r-- | src/gui/speechbubble.cpp | 2 | ||||
-rw-r--r-- | src/gui/status.cpp | 12 | ||||
-rw-r--r-- | src/gui/table.cpp | 4 | ||||
-rw-r--r-- | src/gui/truetypefont.cpp | 2 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/tab.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 2 |
27 files changed, 106 insertions, 96 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 48b1cda4..a06b9a6e 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -103,7 +103,7 @@ void BrowserBox::addRow(const std::string &row) newRow += "##<" + bLink.caption; tmp.erase(0, idx3 + 2); - if (tmp != "") + if (!tmp.empty()) { newRow += "##>"; } diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 1c0cea13..2845691a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -91,7 +91,7 @@ Window(""), mNetwork(network), mTmpVisible(false) // Read the party prefix std::string partyPrefix = config.getValue("PartyPrefix", "$"); - mPartyPrefix = (partyPrefix == "" ? '$' : partyPrefix.at(0)); + mPartyPrefix = (partyPrefix.empty() ? '$' : partyPrefix.at(0)); mReturnToggles = config.getValue("ReturnToggles", "0") == "1"; mRecorder = new Recorder(this); mParty = new Party(this, mNetwork); @@ -195,7 +195,7 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) lineColor = "##S"; } - if (tmp.nick == "" && tmp.text.substr(0, 17) == "Visible GM status") + if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status") { player_node->setGM(); } @@ -449,7 +449,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) msg = msg.substr(0, space); } - if (msg != "" && msg.at(0) == '/') + if (!msg.empty() && msg.at(0) == '/') { msg.erase(0, 1); } @@ -477,7 +477,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) mRecorder->changeRecordingStatus(msg); else if (command == "toggle") { - if (msg == "") + if (msg.empty()) { chatLog(mReturnToggles ? _("Return toggles chat.") : _("Message closes chat."), BY_SERVER); @@ -508,7 +508,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) } else if (command == "party") { - if (msg == "") + if (msg.empty()) { chatLog(_("Unknown party command... Type \"/help\" party for more " "information."), BY_SERVER); @@ -519,7 +519,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) std::string rest = (space == std::string::npos ? "" : msg.substr(space + 1, msg.length())); - if (rest != "") + if (!rest.empty()) { msg = msg.substr(0, space); trim(msg); @@ -566,7 +566,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) { if ((*bi)->getType() == Being::PLAYER) { - if (response != "") + if (!response.empty()) { response += ", "; } @@ -758,7 +758,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest) { if (command == "prefix") { - if (rest == "") + if (rest.empty()) { char temp[2] = "."; *temp = mPartyPrefix; @@ -789,7 +789,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest) void ChatWindow::help(const std::string & msg1, const std::string & msg2) { chatLog(_("-- Help --"), BY_SERVER); - if (msg1 == "") + if (msg1.empty()) { chatLog(_("/announce: Global announcement (GM only)"), BY_SERVER); chatLog(_("/clear: Clears this window"), BY_SERVER); diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index dd605be6..b9cfd789 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -26,7 +26,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget) /* If there is another widget with modal focus, remove its modal focus * and put it on the modal widget stack. */ - if (mModalFocusedWidget != NULL && mModalFocusedWidget != widget) + if (mModalFocusedWidget && mModalFocusedWidget != widget) { mModalStack.push_front(mModalFocusedWidget); mModalFocusedWidget = NULL; diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index b9fe1c90..af3b29a2 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -87,12 +87,12 @@ InventoryWindow::InventoryWindow(int invSize): mWeightBar = new ProgressBar(1.0f, 100, 20, 0, 0, 255); setMinHeight(130); - setMinWidth(mWeightLabel->getWidth() + mSlotsLabel->getWidth() + 310); + setMinWidth(mWeightLabel->getWidth() + mSlotsLabel->getWidth() + 280); place(0, 0, mWeightLabel).setPadding(3); - place(1, 0, mWeightBar, 2); - place(3, 0, mSlotsLabel).setPadding(3); - place(4, 0, mSlotsBar, 2); + place(1, 0, mWeightBar, 3); + place(4, 0, mSlotsLabel).setPadding(3); + place(5, 0, mSlotsBar, 2); place(0, 1, mInvenScroll, 7, 4); place(5, 5, mDropButton); place(6, 5, mUseButton); diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index df7afa48..4c117f0a 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -108,7 +108,7 @@ void ItemPopup::setItem(const ItemInfo &item) mItemName->setWidth(boldFont->getWidth(item.getName())); mItemDesc->setTextWrapped(item.getDescription(), 196); mItemEffect->setTextWrapped(item.getEffect(), 196); - mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) + + mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) + _(" grams"), 196); int minWidth = mItemName->getWidth(); @@ -136,9 +136,9 @@ void ItemPopup::setItem(const ItemInfo &item) mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth, numRowsWeight * getFont()->getHeight())); - if (item.getEffect() == "") + if (item.getEffect().empty()) { - setContentSize(minWidth, (numRowsDesc * getFont()->getHeight() + + setContentSize(minWidth, (numRowsDesc * getFont()->getHeight() + (3 * getFont()->getHeight()))); mItemWeightScroll->setPosition(2, @@ -147,7 +147,7 @@ void ItemPopup::setItem(const ItemInfo &item) } else { - setContentSize(minWidth, (numRowsDesc * getFont()->getHeight()) + + setContentSize(minWidth, (numRowsDesc * getFont()->getHeight()) + (numRowsEffect * getFont()->getHeight()) + (3 * getFont()->getHeight())); diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 47d5a99e..90ceab1a 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -189,7 +189,7 @@ bool LoginDialog::canSubmit() bool LoginDialog::isUShort(const std::string &str) { - if (str == "") + if (str.empty()) { return false; } @@ -228,7 +228,7 @@ unsigned short LoginDialog::getUShort(const std::string &str) void LoginDialog::DropDownList::saveEntry(const std::string &server, const std::string &port, int &saved) { - if (saved < MAX_SERVER_LIST_SIZE && server != "") + if (saved < MAX_SERVER_LIST_SIZE && !server.empty()) { config.setValue(mConfigPrefix + "Server" + toString(saved), server); config.setValue(mConfigPrefix + "Port" + toString(saved), port); @@ -247,7 +247,7 @@ LoginDialog::DropDownList::DropDownList(std::string prefix, { std::string server = config.getValue(mConfigPrefix + "Server" + toString(i), ""); - if (server == "") // Just in case had original config entries + if (server.empty()) // Just in case had original config entries { server = config.getValue(mConfigPrefix + "ServerList" + toString(i), ""); @@ -255,13 +255,13 @@ LoginDialog::DropDownList::DropDownList(std::string prefix, std::string port = config.getValue(mConfigPrefix + "Port" + toString(i), dfltPort.front()); - if (server != "") + if (!server.empty()) { mServers.push_back(server); mPorts.push_back(port); } } - if (mServers.size() == 0) + if (mServers.empty()) { mServers.assign(dflt.begin(), dflt.end()); mPorts.assign(dfltPort.begin(), dfltPort.end()); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 55cd8b5d..ccadf3e1 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -75,7 +75,7 @@ void Minimap::setMapImage(Image *img) setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth); setMinHeight(mapHeight); - setMaxWidth(mMapImage->getWidth() > titleWidth ? + setMaxWidth(mMapImage->getWidth() > titleWidth ? mMapImage->getWidth() + offsetX : titleWidth); setMaxHeight(mMapImage->getHeight() + offsetY); diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index 60003fb5..f99ce6ef 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -87,7 +87,7 @@ void PlayerBox::draw(gcn::Graphics *graphics) y = getHeight() / 2 + bs; for (int i = 0; i < Being::VECTOREND_SPRITE; i++) { - if (mPlayer->getSprite(i) != NULL) + if (mPlayer->getSprite(i)) { mPlayer->getSprite(i)->draw(static_cast<Graphics*>(graphics), x, y); } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index be5252f7..3503d0ea 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -148,7 +148,7 @@ void PopupMenu::handleLink(const std::string& link) // Talk To action if (link == "talk" && - being != NULL && + being && being->getType() == Being::NPC && current_npc == 0) { @@ -157,7 +157,7 @@ void PopupMenu::handleLink(const std::string& link) // Trade action else if (link == "trade" && - being != NULL && + being && being->getType() == Being::PLAYER) { player_node->trade(being); @@ -166,35 +166,35 @@ void PopupMenu::handleLink(const std::string& link) // Attack action else if (link == "attack" && - being != NULL && + being && being->getType() == Being::PLAYER) { player_node->attack(being, true); } else if (link == "unignore" && - being != NULL && + being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL); } else if (link == "ignore" && - being != NULL && + being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::IGNORED); } else if (link == "disregard" && - being != NULL && + being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED); } else if (link == "friend" && - being != NULL && + being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::FRIEND); @@ -208,7 +208,7 @@ void PopupMenu::handleLink(const std::string& link) /* // Add Buddy action - else if ((link == "buddy") && being != NULL && being->isPlayer()) + else if ((link == "buddy") && being && being->isPlayer()) { if (!buddyWindow->isVisible()) buddyWindow->setVisible(true); @@ -217,7 +217,7 @@ void PopupMenu::handleLink(const std::string& link) }*/ // Pick Up Floor Item action - else if ((link == "pickup") && mFloorItem != NULL) + else if ((link == "pickup") && mFloorItem) { player_node->pickUp(mFloorItem); } @@ -257,7 +257,7 @@ void PopupMenu::handleLink(const std::string& link) new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem); } else if (link == "party-invite" && - being != NULL && + being && being->getType() == Being::PLAYER) { MessageOut outMsg(player_node->getNetwork()); diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index de8d4d9d..c8ae2fad 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -92,7 +92,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics) else box = radioDisabled; - if (box != NULL) + if (box) static_cast<Graphics*>(graphics)->drawImage(box, 2, 2); } diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp index 1e7d8e13..40ef974b 100644 --- a/src/gui/recorder.cpp +++ b/src/gui/recorder.cpp @@ -1,21 +1,21 @@ /* - * The Mana World - * Copyright 2004 The Mana World Development Team + * A chat recorder + * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net> * * This file is part of The Mana World. * - * The Mana World is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * - * The Mana World is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -40,7 +40,7 @@ Recorder::Recorder(ChatWindow *chat, const std::string &title, mChat = chat; Button *button = new Button(buttonTxt, "activate", this); - setDefaultSize(0, windowContainer->getHeight() - 123 - button->getHeight() - + setDefaultSize(0, windowContainer->getHeight() - 123 - button->getHeight() - offsetY, button->getWidth() + offsetX, button->getHeight() + offsetY); @@ -52,6 +52,10 @@ Recorder::Recorder(ChatWindow *chat, const std::string &title, loadWindowState(); } +Recorder::~Recorder() +{ +} + void Recorder::record(const std::string &msg) { if (mStream.is_open()) @@ -65,7 +69,7 @@ void Recorder::changeRecordingStatus(const std::string &msg) std::string msgCopy = msg; trim(msgCopy); - if (msgCopy == "") + if (msgCopy.empty()) { if (mStream.is_open()) { @@ -94,8 +98,9 @@ void Recorder::changeRecordingStatus(const std::string &msg) * recorded. */ mChat->chatLog(_("Starting to record..."), BY_SERVER); - std::string file = std::string(PHYSFS_getUserDir()) + "/.aethyra/" + msgCopy; - + const std::string file = + std::string(PHYSFS_getUserDir()) + "/.tmw/" + msgCopy; + mStream.open(file.c_str(), std::ios_base::trunc); if (mStream.is_open()) @@ -109,7 +114,3 @@ void Recorder::action(const gcn::ActionEvent &event) { changeRecordingStatus(""); } - -Recorder::~Recorder() -{ -} diff --git a/src/gui/register.cpp b/src/gui/register.cpp index cf12375c..e17f5902 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -152,7 +152,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) else if (event.getId() == "register" && canSubmit()) { const std::string user = mUserField->getText(); - logger->log(_("RegisterDialog::register Username is %s"), user.c_str()); + logger->log("RegisterDialog::register Username is %s", user.c_str()); std::string errorMsg; int error = 0; @@ -249,7 +249,7 @@ bool RegisterDialog::canSubmit() const bool RegisterDialog::isUShort(const std::string &str) { - if (str == "") + if (str.empty()) { return false; } diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index eacc4714..bc3a62dc 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -153,7 +153,7 @@ void ScrollArea::logic() // When no scrollbar in a certain direction, adapt content size to match // the content dimension exactly. - if (content != NULL) + if (content) { if (getHorizontalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER) { diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index 269f8fd1..372dbd17 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -47,11 +47,11 @@ Setup_Colors::Setup_Colors() : { setOpaque(false); - mcolorBox = new ListBox(textColor); - mcolorBox->setActionEventId("color_box"); - mcolorBox->addActionListener(this); + mColorBox = new ListBox(textColor); + mColorBox->setActionEventId("color_box"); + mColorBox->addActionListener(this); - mScroll = new ScrollArea(mcolorBox); + mScroll = new ScrollArea(mColorBox); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mPreview = new BrowserBox(BrowserBox::AUTO_WRAP); @@ -150,7 +150,7 @@ void Setup_Colors::action(const gcn::ActionEvent &event) { if (event.getId() == "color_box") { - mSelected = mcolorBox->getSelected(); + mSelected = mColorBox->getSelected(); int col = textColor->getColorAt(mSelected); char ch = textColor->getColorCharAt(mSelected); std::string msg; diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h index 1e56cfa8..8fd1ba59 100644 --- a/src/gui/setup_colors.h +++ b/src/gui/setup_colors.h @@ -48,7 +48,7 @@ class Setup_Colors : public SetupTab, public gcn::ActionListener, void listen(const TextField *tf); private: - gcn::ListBox *mcolorBox; + gcn::ListBox *mColorBox; gcn::ScrollArea *mScroll; BrowserBox *mPreview; gcn::ScrollArea *mPreviewBox; diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index 5c19bd2b..d25117de 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -241,7 +241,7 @@ Setup_Players::Setup_Players(): mIgnoreActionChoicesBox = new DropDown(ignoreChoices, new ScrollArea(), new ListBox(ignoreChoices), false); - for (int i = 0; i < COLUMNS_NR; i++) + for (int i = 0; i < COLUMNS_NR; i++) { mPlayerTableTitleModel->set(0, i, new gcn::Label(gettext(table_titles[i]))); diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h index 2edc6983..74247b77 100644 --- a/src/gui/setup_players.h +++ b/src/gui/setup_players.h @@ -32,8 +32,9 @@ class GuiTable; class PlayerTableModel; class StaticTableModel; -class Setup_Players : public SetupTab, - public gcn::ActionListener, public PlayerRelationsListener +class Setup_Players : public SetupTab, + public gcn::ActionListener, + public PlayerRelationsListener { public: Setup_Players(); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index b1d33b09..c02025c8 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -89,9 +89,9 @@ ModeListModel::ModeListModel() /* Check which modes are available */ if (modes == (SDL_Rect **)0) { - logger->log(_("No modes available")); + logger->log("No modes available"); } else if (modes == (SDL_Rect **)-1) { - logger->log(_("All resolutions available")); + logger->log("All resolutions available"); } else { //logger->log("Available Modes"); for (int i = 0; modes[i]; ++i) { diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 5d49a3c6..b6987b3e 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -50,7 +50,7 @@ ShortcutWindow::ShortcutWindow(const char *title, ShortcutContainer *content) const int width = (int) config.getValue("screenwidth", 800); const int height = (int) config.getValue("screenheight", 600); - setDefaultSize(width - (mInstances * mItems->getBoxWidth()) - + setDefaultSize(width - (mInstances * mItems->getBoxWidth()) - (mInstances * border), height - (mItems->getBoxHeight() * mItems->getMaxItems()) - border, mItems->getBoxWidth() + border, (mItems->getBoxHeight() * mItems->getMaxItems()) + diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index c4f8737b..03711a47 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -45,6 +45,11 @@ struct SkillInfo { bool modifiable; }; +static const SkillInfo fakeSkillInfo = { + _("Mystery Skill"), + false +}; + std::vector<SkillInfo> skill_db; static void initSkillinfo(); @@ -80,11 +85,6 @@ public: virtual void update() { - static const SkillInfo fakeSkillInfo = { - _("Mystery Skill"), - false - }; - mEntriesNr = mDialog->getSkills().size(); resize(); @@ -174,10 +174,18 @@ void SkillDialog::action(const gcn::ActionEvent &event) if (selectedSkill >= 0) player_node->raiseSkill(mSkillList[selectedSkill]->id); } - else if (event.getId() == "skill") + else if (event.getId() == "skill" && mTable->getSelectedRow() > -1) { - mIncButton->setEnabled(mTable->getSelectedRow() > -1 && - player_node->mSkillPoint > 0); + SKILL *skill = mSkillList[mTable->getSelectedRow()]; + SkillInfo const *info; + + if (skill->id >= 0 && (unsigned int) skill->id < skill_db.size()) + info = &skill_db[skill->id]; + else + info = &fakeSkillInfo; + + mIncButton->setEnabled(player_node->mSkillPoint > 0 && + info->modifiable); } else if (event.getId() == "close") setVisible(false); @@ -261,7 +269,7 @@ static void initSkillinfo() if (!root || !xmlStrEqual(root->name, BAD_CAST "skills")) { - logger->log(_("Error loading skills file: %s"), SKILLS_FILE); + logger->log("Error loading skills file: %s", SKILLS_FILE); skill_db.resize(2, emptySkillInfo); skill_db[1].name = "Basic"; skill_db[1].modifiable = true; diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index c76558e4..dd404a63 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -85,7 +85,7 @@ void SpeechBubble::setText(std::string mText) width = mSpeechBox->getMinWidth(); setContentSize(width + fontHeight, (numRows * fontHeight) + 6); - mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, width + 5, + mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, width + 5, (numRows * fontHeight))); } diff --git a/src/gui/status.cpp b/src/gui/status.cpp index 21087fad..683a9a41 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -41,7 +41,7 @@ StatusWindow::StatusWindow(LocalPlayer *player): setWindowName(_("Status")); setCloseButton(true); setDefaultSize((windowContainer->getWidth() - 365) / 2, - (windowContainer->getHeight() - 255) / 2, 400, 335); + (windowContainer->getHeight() - 255) / 2, 400, 345); // ---------------------- // Status Part @@ -119,20 +119,20 @@ StatusWindow::StatusWindow(LocalPlayer *player): place(0, 0, mLvlLabel, 3); place(5, 0, mJobLvlLabel, 3); place(8, 0, mGpLabel, 3); - place(1, 1, mHpLabel); + place(1, 1, mHpLabel).setPadding(3); place(2, 1, mHpBar, 3); - place(6, 1, mXpLabel); + place(6, 1, mXpLabel).setPadding(3); place(7, 1, mXpBar, 3); - place(1, 2, mMpLabel); + place(1, 2, mMpLabel).setPadding(3); place(2, 2, mMpBar, 3); - place(6, 2, mJobLabel); + place(6, 2, mJobLabel).setPadding(3); place(7, 2, mJobBar, 3); place.getCell().matchColWidth(0, 1); place = getPlacer(0, 3); place(0, 0, mStatsTitleLabel, 5); place(5, 1, mStatsTotalLabel, 5); place(12, 1, mStatsCostLabel, 5); - for(int i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) { place(0, 2 + i, mStatsLabel[i], 7).setPadding(5); place(7, 2 + i, mStatsDisplayLabel[i]).setPadding(5); diff --git a/src/gui/table.cpp b/src/gui/table.cpp index 1ee9da0f..8dd546d9 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -185,7 +185,7 @@ int GuiTable::getColumnWidth(int i) void GuiTable::setSelectedRow(int selected) { - if (mModel == NULL) + if (!mModel) { mSelectedRow = -1; } @@ -213,7 +213,7 @@ void GuiTable::setSelectedRow(int selected) void GuiTable::setSelectedColumn(int selected) { - if (mModel == NULL) + if (!mModel) { mSelectedColumn = -1; } diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 66855b77..8e6636df 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -91,7 +91,7 @@ TrueTypeFont::TrueTypeFont(const std::string &filename, int size) ++fontCounter; mFont = TTF_OpenFont(filename.c_str(), size); - if (mFont == NULL) + if (!mFont) { throw GCN_EXCEPTION("SDLTrueTypeFont::SDLTrueTypeFont: " + std::string(TTF_GetError())); diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 1f62bd2d..b3861b27 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -75,7 +75,7 @@ std::vector<std::string> loadTextFile(const std::string &fileName) std::ifstream fin(fileName.c_str()); if (!fin) { - logger->log(_("Couldn't load text file: %s"), fileName.c_str()); + logger->log("Couldn't load text file: %s", fileName.c_str()); return lines; } @@ -193,7 +193,7 @@ void UpdaterWindow::loadNews() { if (!mMemoryBuffer) { - logger->log(_("Couldn't load news")); + logger->log("Couldn't load news"); return; } @@ -205,7 +205,7 @@ void UpdaterWindow::loadNews() // Tokenize and add each line separately char *line = strtok(mMemoryBuffer, "\n"); - while (line != NULL) + while (line) { mBrowserBox->addRow(line); line = strtok(NULL, "\n"); @@ -408,9 +408,9 @@ void UpdaterWindow::download() mDownloadComplete = false; mThread = SDL_CreateThread(UpdaterWindow::downloadThread, this); - if (mThread == NULL) + if (!mThread) { - logger->log(_("Unable to create mThread")); + logger->log("Unable to create mThread"); mDownloadStatus = UPDATE_ERROR; } } @@ -504,7 +504,7 @@ void UpdaterWindow::logic() } else { - logger->log(_("%s already here"), mCurrentFile.c_str()); + logger->log("%s already here", mCurrentFile.c_str()); } mLineIndex++; } diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 22e952e7..21402c89 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -51,10 +51,10 @@ struct TabData }; static TabData const data[TAB_COUNT] = { - {"graphics/gui/tab.png", 0, 0}, - {"graphics/gui/tab.png", 9, 4}, - {"graphics/gui/tabselected.png", 16, 19}, - {"graphics/gui/tab.png", 25, 23} + { "graphics/gui/tab.png", 0, 0 }, + { "graphics/gui/tab.png", 9, 4 }, + { "graphics/gui/tabselected.png", 16, 19 }, + { "graphics/gui/tab.png", 25, 23 } }; ImageRect Tab::tabImg[TAB_COUNT]; @@ -117,7 +117,7 @@ void Tab::draw(gcn::Graphics *graphics) // check which type of tab to draw if (mTabbedArea) { - if(mTabbedArea->isTabSelected(this)) + if (mTabbedArea->isTabSelected(this)) { mode = TAB_SELECTED; // if tab is selected, it doesnt need to highlight activity diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index c4e22bff..5ff7c4bc 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -90,7 +90,7 @@ void TabbedArea::addTab(Tab *tab, gcn::Widget *widget) mTabContainer->add(tab); mTabs.push_back(std::pair<Tab*, gcn::Widget*>(tab, widget)); - if (mSelectedTab == NULL) + if (!mSelectedTab) { setSelectedTab(tab); } |