diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-11 00:01:36 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-11 00:01:36 +0100 |
commit | dbc6444d3086fa1b7afca4605600a0a0ae8ca394 (patch) | |
tree | 929a30503728e9f657c9a8820b3a9069b916343e /src/gui | |
parent | 8712ce09e8f3a86dcf2f6c8ee7d030e3b41a4618 (diff) | |
download | mana-dbc6444d3086fa1b7afca4605600a0a0ae8ca394.tar.gz mana-dbc6444d3086fa1b7afca4605600a0a0ae8ca394.tar.bz2 mana-dbc6444d3086fa1b7afca4605600a0a0ae8ca394.tar.xz mana-dbc6444d3086fa1b7afca4605600a0a0ae8ca394.zip |
Removed many pointless comparisons with NULL
Sometimes it's nice for clarity, but most of the time this is just
clutter. C++ != Java. :)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/focushandler.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/scrollarea.cpp | 2 | ||||
-rw-r--r-- | src/gui/table.cpp | 4 | ||||
-rw-r--r-- | src/gui/truetypefont.cpp | 2 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 2 |
9 files changed, 20 insertions, 20 deletions
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/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/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/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 01c28aca..b3861b27 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -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,7 +408,7 @@ void UpdaterWindow::download() mDownloadComplete = false; mThread = SDL_CreateThread(UpdaterWindow::downloadThread, this); - if (mThread == NULL) + if (!mThread) { logger->log("Unable to create mThread"); mDownloadStatus = UPDATE_ERROR; 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); } |