diff options
Diffstat (limited to 'src/gui')
92 files changed, 447 insertions, 426 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp index 98df1ca9a..759d4c245 100644 --- a/src/gui/beingpopup.cpp +++ b/src/gui/beingpopup.cpp @@ -130,7 +130,7 @@ void BeingPopup::show(int x, int y, Being *b) label4 = label3; label3 = label2; label2 = label1; - label1 = 0; + label1 = nullptr; } if (!(b->getGuildName().empty())) @@ -143,7 +143,7 @@ void BeingPopup::show(int x, int y, Being *b) { label4 = label3; label3 = label2; - label2 = 0; + label2 = nullptr; } if (b->getPvpRank() > 0) @@ -154,7 +154,7 @@ void BeingPopup::show(int x, int y, Being *b) else { label4 = label3; - label3 = 0; + label3 = nullptr; } if (!b->getComment().empty()) @@ -165,7 +165,7 @@ void BeingPopup::show(int x, int y, Being *b) } else { - label4 = 0; + label4 = nullptr; } int minWidth = mBeingName->getWidth(); diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index 88bc65a78..bff9ad31a 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -263,7 +263,7 @@ protected: BotCheckerWindow::BotCheckerWindow(): - Window(_("Bot Checker"), false, 0, "botchecker.xml"), + Window(_("Bot Checker"), false, nullptr, "botchecker.xml"), mEnabled(false) { int w = 500; diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 384ebf07f..3c412b424 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -45,7 +45,7 @@ #include "debug.h" ChangeEmailDialog::ChangeEmailDialog(LoginData *data): - Window(_("Change Email Address"), true, 0, "changeemail.xml"), + Window(_("Change Email Address"), true, nullptr, "changeemail.xml"), mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { @@ -102,7 +102,7 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData *data): ChangeEmailDialog::~ChangeEmailDialog() { delete mWrongDataNoticeListener; - mWrongDataNoticeListener = 0; + mWrongDataNoticeListener = nullptr; } void ChangeEmailDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 7a67279b6..a7ebaebca 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -47,7 +47,7 @@ #include "debug.h" ChangePasswordDialog::ChangePasswordDialog(LoginData *data): - Window(_("Change Password"), true, 0, "changepassword.xml"), + Window(_("Change Password"), true, nullptr, "changepassword.xml"), mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { @@ -82,7 +82,7 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *data): ChangePasswordDialog::~ChangePasswordDialog() { delete mWrongDataNoticeListener; - mWrongDataNoticeListener = 0; + mWrongDataNoticeListener = nullptr; } void ChangePasswordDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index efe7e804f..0cde69386 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -63,7 +63,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): setStickyButtonLock(true); setSticky(true); - mPlayer = new Being(0, ActorSprite::PLAYER, mRace, NULL); + mPlayer = new Being(0, ActorSprite::PLAYER, mRace, nullptr); mPlayer->setGender(GENDER_MALE); int numberOfHairColors = ColorDB::getHairSize(); diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 00cae41e6..93302e0ff 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -122,14 +122,14 @@ class CharacterDisplay : public Container }; CharSelectDialog::CharSelectDialog(LoginData *data): - Window(_("Account and Character Management"), false, 0, "char.xml"), + Window(_("Account and Character Management"), false, nullptr, "char.xml"), mLocked(false), - mUnregisterButton(0), - mChangeEmailButton(0), + mUnregisterButton(nullptr), + mChangeEmailButton(nullptr), mCharacterEntries(0), mLoginData(data), mCharHandler(Net::getCharHandler()), - mDeleteDialog(0), + mDeleteDialog(nullptr), mDeleteIndex(-1) { setCloseButton(false); @@ -246,7 +246,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) == LoginDialog::savedPassword) { attemptCharacterDelete(mDeleteIndex); - mDeleteDialog = 0; + mDeleteDialog = nullptr; } else { @@ -313,7 +313,7 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters) for (iter = mCharacterEntries.begin(), iter_end = mCharacterEntries.end(); iter != iter_end; ++iter) { - (*iter)->setCharacter(0); + (*iter)->setCharacter(nullptr); } Net::Characters::const_iterator i, i_end = characters.end(); @@ -399,7 +399,7 @@ bool CharSelectDialog::selectByName(const std::string &name, CharacterDisplay::CharacterDisplay(CharSelectDialog *charSelectDialog): - mCharacter(0), + mCharacter(nullptr), mPlayerBox(new PlayerBox) { mButton = new Button("wwwwwwwww", "go", charSelectDialog); @@ -445,7 +445,7 @@ void CharacterDisplay::setCharacter(Net::Character *character) return; mCharacter = character; - mPlayerBox->setPlayer(character ? character->dummy : 0); + mPlayerBox->setPlayer(character ? character->dummy : nullptr); update(); } diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index cdcd02bc3..35b89b839 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -149,7 +149,7 @@ public: ChatWindow::ChatWindow(): - Window(_("Chat"), false, 0, "chat.xml"), + Window(_("Chat"), false, nullptr, "chat.xml"), mTmpVisible(false), mChatHistoryIndex(0) { @@ -222,11 +222,11 @@ ChatWindow::~ChatWindow() config.setValue("ReturnToggles", mReturnToggles); removeAllWhispers(); delete mItemLinkHandler; - mItemLinkHandler = 0; + mItemLinkHandler = nullptr; delete mColorPicker; - mColorPicker = 0; + mColorPicker = nullptr; delete mColorListModel; - mColorListModel = 0; + mColorListModel = nullptr; } void ChatWindow::fillCommands() @@ -557,13 +557,13 @@ void ChatWindow::ignoreAllWhispers() } delete(iter->second); - iter->second = 0; + iter->second = nullptr; } } void ChatWindow::chatInput(const std::string &message) { - ChatTab *tab = NULL; + ChatTab *tab = nullptr; std::string msg = message; trim(msg); @@ -939,7 +939,7 @@ void ChatWindow::addWhisper(const std::string &nick, if (tempNick.compare(playerName) == 0) return; - ChatTab *tab = 0; + ChatTab *tab = nullptr; TabMap::const_iterator i = mWhispers.find(tempNick); if (i != mWhispers.end()) @@ -1006,7 +1006,7 @@ void ChatWindow::addWhisper(const std::string &nick, { localChatTab->chatLog(nick + " : " + mes, ACT_WHISPER, false); if (player_node) - player_node->afkRespond(0, nick); + player_node->afkRespond(nullptr, nick); } } } @@ -1014,7 +1014,7 @@ void ChatWindow::addWhisper(const std::string &nick, ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) { if (!player_node) - return NULL; + return nullptr; std::string playerName = player_node->getName(); std::string tempNick = nick; @@ -1026,7 +1026,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) ChatTab *ret; if (tempNick.compare(playerName) == 0) - return NULL; + return nullptr; if (i != mWhispers.end()) { @@ -1051,7 +1051,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const { if (!player_node) - return NULL; + return nullptr; std::string playerName = player_node->getName(); std::string tempNick = nick; @@ -1060,10 +1060,10 @@ ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const toLower(tempNick); TabMap::const_iterator i = mWhispers.find(tempNick); - ChatTab *ret = 0; + ChatTab *ret = nullptr; if (tempNick.compare(playerName) == 0) - return NULL; + return nullptr; if (i != mWhispers.end()) ret = i->second; @@ -1350,8 +1350,8 @@ void ChatWindow::initTradeFilter() void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers) { TabMap::const_iterator iter; - const Party *party = 0; - const Guild *guild = 0; + const Party *party = nullptr; + const Guild *guild = nullptr; if (player_node) { party = player_node->getParty(); diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index f7f81bd2f..298855563 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -46,7 +46,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, gcn::Button *yesButton = new Button(_("Yes"), "yes", this); gcn::Button *noButton = new Button(_("No"), "no", this); - gcn::Button *ignoreButton = NULL; + gcn::Button *ignoreButton = nullptr; if (ignore) ignoreButton = new Button(_("Ignore"), "ignore", this); diff --git a/src/gui/confirmdialog.h b/src/gui/confirmdialog.h index 214aaba60..2b5febed0 100644 --- a/src/gui/confirmdialog.h +++ b/src/gui/confirmdialog.h @@ -23,6 +23,8 @@ #ifndef OPTION_DIALOG_H #define OPTION_DIALOG_H +#include "localconsts.h" + #include "gui/widgets/window.h" #include <guichan/actionlistener.hpp> @@ -44,7 +46,7 @@ class ConfirmDialog : public Window, public gcn::ActionListener */ ConfirmDialog(const std::string &title, const std::string &msg, bool ignore = false, bool modal = false, - Window *parent = NULL); + Window *parent = nullptr); /** * Called when receiving actions from the widgets. diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 83e9791ef..56a63c72d 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -51,7 +51,7 @@ #include "debug.h" DebugWindow::DebugWindow(): - Window(_("Debug"), false, 0, "debug.xml") + Window(_("Debug"), false, nullptr, "debug.xml") { setWindowName("Debug"); if (setupWindow) @@ -85,11 +85,11 @@ DebugWindow::DebugWindow(): DebugWindow::~DebugWindow() { delete mMapWidget; - mMapWidget = 0; + mMapWidget = nullptr; delete mTargetWidget; - mTargetWidget = 0; + mTargetWidget = nullptr; delete mNetWidget; - mNetWidget = 0; + mNetWidget = nullptr; } void DebugWindow::logic() @@ -139,7 +139,7 @@ void DebugWindow::widgetResized(const gcn::Event &event) } MapDebugTab::MapDebugTab() : - mTexturesLabel(0) + mTexturesLabel(nullptr) { LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index df15e6ebd..9a913a305 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -44,7 +44,7 @@ static const int minTip = 1; static const int maxTip = 14; DidYouKnowWindow::DidYouKnowWindow(): - Window(_("Did You Know?"), false, 0, "didyouknow.xml") + Window(_("Did You Know?"), false, nullptr, "didyouknow.xml") { setMinWidth(300); setMinHeight(250); diff --git a/src/gui/editdialog.h b/src/gui/editdialog.h index dc0d1cc63..69f86edca 100644 --- a/src/gui/editdialog.h +++ b/src/gui/editdialog.h @@ -24,6 +24,8 @@ #ifndef EDIT_DIALOG_H #define EDIT_DIALOG_H +#include "localconsts.h" + #include "gui/widgets/window.h" #include "gui/widgets/textfield.h" @@ -48,7 +50,7 @@ class EditDialog : public Window, public gcn::ActionListener */ EditDialog(const std::string &title, const std::string &msg, std::string eventOk = ACTION_EDIT_OK, int width = 300, - Window *parent = NULL, bool modal = true); + Window *parent = nullptr, bool modal = true); /** * Called when receiving actions from the widgets. diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index 6d2bf7be2..a8c92ed47 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -80,7 +80,7 @@ EmotePopup::~EmotePopup() if (mSelectionImage) { mSelectionImage->decRef(); - mSelectionImage = 0; + mSelectionImage = nullptr; } } diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index f423cddf0..d3d230922 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -58,7 +58,7 @@ static const int BOX_HEIGHT = 36; EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being, bool foring): - Window(_("Equipment"), false, 0, "equipment.xml"), + Window(_("Equipment"), false, nullptr, "equipment.xml"), mEquipment(equipment), mSelected(-1), mForing(foring) @@ -86,7 +86,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being, mBoxes.reserve(13); for (int f = 0; f < 13; f ++) - mBoxes.push_back(0); + mBoxes.push_back(nullptr); fillBoxes(); @@ -109,13 +109,13 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being, EquipmentWindow::~EquipmentWindow() { delete mItemPopup; - mItemPopup = 0; + mItemPopup = nullptr; if (this == beingEquipmentWindow) { if (mEquipment) delete mEquipment->getBackend(); delete mEquipment; - mEquipment = 0; + mEquipment = nullptr; } delete_all(mBoxes); mBoxes.clear(); @@ -198,7 +198,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event) Item *EquipmentWindow::getItem(int x, int y) const { if (!mEquipment) - return 0; + return nullptr; std::vector<std::pair<int, int>*>::const_iterator it; std::vector<std::pair<int, int>*>::const_iterator it_end = mBoxes.end(); @@ -215,7 +215,7 @@ Item *EquipmentWindow::getItem(int x, int y) const if (tRect.isPointInRect(x, y)) return mEquipment->getEquipment(i); } - return NULL; + return nullptr; } void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) @@ -322,7 +322,7 @@ void EquipmentWindow::setBeing(Being *being) delete mEquipment; if (!being) { - mEquipment = 0; + mEquipment = nullptr; return; } mEquipment = being->getEquipment(); @@ -337,7 +337,7 @@ void EquipmentWindow::updateBeing(Being *being) void EquipmentWindow::resetBeing(Being *being) { if (being == mBeing) - setBeing(0); + setBeing(nullptr); } void EquipmentWindow::fillBoxes() diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index ec854cf87..40fa2f4ed 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -34,7 +34,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget) if (mModalFocusedWidget && mModalFocusedWidget != widget) { mModalStack.push_front(mModalFocusedWidget); - mModalFocusedWidget = NULL; + mModalFocusedWidget = nullptr; } gcn::FocusHandler::requestModalFocus(widget); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 658d65769..b3154fb25 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -48,11 +48,11 @@ #include "debug.h" // Guichan stuff -Gui *gui = 0; -SDLInput *guiInput = 0; +Gui *gui = nullptr; +SDLInput *guiInput = nullptr; // Bolded font -gcn::Font *boldFont = 0; +gcn::Font *boldFont = nullptr; class GuiConfigListener : public ConfigListener { @@ -75,7 +75,7 @@ class GuiConfigListener : public ConfigListener Gui::Gui(Graphics *graphics): mCustomCursor(false), - mMouseCursors(NULL), + mMouseCursors(nullptr), mMouseCursorAlpha(1.0f), mMouseInactivityTimer(0), mCursorType(CURSOR_POINTER) @@ -205,28 +205,28 @@ Gui::~Gui() { config.removeListener("customcursor", mConfigListener); delete mConfigListener; - mConfigListener = 0; + mConfigListener = nullptr; if (mMouseCursors) { mMouseCursors->decRef(); - mMouseCursors = 0; + mMouseCursors = nullptr; } delete mGuiFont; - mGuiFont = 0; + mGuiFont = nullptr; delete boldFont; - boldFont = 0; + boldFont = nullptr; delete mHelpFont; - mHelpFont = 0; + mHelpFont = nullptr; delete mSecureFont; - mSecureFont = 0; + mSecureFont = nullptr; delete mInfoParticleFont; - mInfoParticleFont = 0; + mInfoParticleFont = nullptr; delete getTop(); delete guiInput; - guiInput = 0; + guiInput = nullptr; Theme::deleteInstance(); } @@ -306,7 +306,7 @@ void Gui::setUseCustomCursor(bool customCursor) if (mMouseCursors) { mMouseCursors->decRef(); - mMouseCursors = NULL; + mMouseCursors = nullptr; } } } @@ -357,13 +357,13 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, gcn::Widget* parent = source; gcn::Widget* widget = source; - if (!force && mFocusHandler->getModalFocused() != NULL + if (!force && mFocusHandler->getModalFocused() != nullptr && !widget->isModalFocused()) { return; } - if (!force && mFocusHandler->getModalMouseInputFocused() != NULL + if (!force && mFocusHandler->getModalMouseInputFocused() != nullptr && !widget->isModalMouseInputFocused()) { return; @@ -373,7 +373,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, mAltPressed, mMetaPressed, type, button, x, y, mClickCount); - while (parent != NULL) + while (parent) { // If the widget has been removed due to input // cancel the distribution. @@ -443,7 +443,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, // If a non modal focused widget has been reach // and we have modal focus cancel the distribution. - if (mFocusHandler->getModalFocused() != NULL + if (mFocusHandler->getModalFocused() && !widget->isModalFocused()) { break; @@ -451,7 +451,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, // If a non modal mouse input focused widget has been reach // and we have modal mouse input focus cancel the distribution. - if (mFocusHandler->getModalMouseInputFocused() != NULL + if (mFocusHandler->getModalMouseInputFocused() && !widget->isModalMouseInputFocused()) { break; diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index 019baf503..49f309bca 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -40,7 +40,7 @@ #include "debug.h" HelpWindow::HelpWindow(): - Window(_("Help"), false, 0, "help.xml") + Window(_("Help"), false, nullptr, "help.xml") { setMinWidth(300); setMinHeight(250); diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index f52151698..8ffebebff 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -96,7 +96,7 @@ public: InventoryWindow::WindowList InventoryWindow::instances; InventoryWindow::InventoryWindow(Inventory *inventory): - Window("Inventory", false, 0, "inventory.xml"), + Window("Inventory", false, nullptr, "inventory.xml"), mInventory(inventory), mDropButton(0), mSplit(false), @@ -238,7 +238,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): loadWindowState(); slotsChanged(mInventory); - widgetResized(0); + widgetResized(nullptr); if (!isMainInventory()) setVisible(true); } @@ -250,7 +250,7 @@ InventoryWindow::~InventoryWindow() if (!instances.empty()) instances.front()->updateDropButton(); delete mSortModel; - mSortModel = 0; + mSortModel = nullptr; } void InventoryWindow::action(const gcn::ActionEvent &event) @@ -644,7 +644,7 @@ void InventoryWindow::updateDropButton() } else { - Item *item = 0; + Item *item = nullptr; if (mItems) item = mItems->getSelectedItem(); diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index 7c5b19415..a80434ac0 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -138,13 +138,13 @@ void ItemAmountWindow::finish(Item *item, int amount, int price, Usage usage) ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, int maxRange): Window("", true, parent, "amount.xml"), - mItemPriceTextField(0), - mGPLabel(0), + mItemPriceTextField(nullptr), + mGPLabel(nullptr), mItem(item), mMax(maxRange), mUsage(usage), - mItemPriceSlide(0), - mItemsModal(0), + mItemPriceSlide(nullptr), + mItemsModal(nullptr), mPrice(0) { if (!mItem) @@ -293,7 +293,7 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, ItemAmountWindow::~ItemAmountWindow() { delete mItemPopup; - mItemPopup = 0; + mItemPopup = nullptr; } // Show ItemTooltip diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index b05d7fe28..2e87cd544 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -50,7 +50,7 @@ ItemPopup::ItemPopup(): Popup("ItemPopup", "itempopup.xml"), - mIcon(0), + mIcon(nullptr), mLastName(""), mLastColor(1) { @@ -76,7 +76,7 @@ ItemPopup::ItemPopup(): mItemWeight->setEditable(false); mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding()); - mIcon = new Icon(0); + mIcon = new Icon(nullptr); add(mItemName); add(mItemDesc); @@ -95,7 +95,7 @@ ItemPopup::~ItemPopup() if (image) { image->decRef(); - image = 0; + image = nullptr; } } } @@ -164,7 +164,7 @@ void ItemPopup::setItem(const ItemInfo &item, unsigned char color, } else { - mIcon->setImage(0); + mIcon->setImage(nullptr); } mItemType = item.getType(); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 4bcab0a09..fa6241ef6 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -43,7 +43,7 @@ #include "debug.h" KillStats::KillStats(): - Window(_("Kill stats"), false, 0, "killstats.xml"), + Window(_("Kill stats"), false, nullptr, "killstats.xml"), mKillCounter(0), mExpCounter(0), mKillTCounter(0), mExpTCounter(0), mKillTimer(0), m1minExpTime(0), m1minExpNum(0), m1minSpeed(0), diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index 136a01b37..86b3dc28b 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -83,7 +83,7 @@ public: LoginDialog::LoginDialog(LoginData *data, std::string serverName, std::string *updateHost): - Window(_("Login"), false, 0, "login.xml"), + Window(_("Login"), false, nullptr, "login.xml"), mLoginData(data), mUpdateHost(updateHost), mServerName(serverName) @@ -166,7 +166,7 @@ LoginDialog::LoginDialog(LoginData *data, std::string serverName, LoginDialog::~LoginDialog() { delete mUpdateTypeModel; - mUpdateTypeModel = 0; + mUpdateTypeModel = nullptr; } void LoginDialog::action(const gcn::ActionEvent &event) @@ -226,9 +226,9 @@ void LoginDialog::keyPressed(gcn::KeyEvent &keyEvent) gcn::Key key = keyEvent.getKey(); if (key.getValue() == Key::ESCAPE) - action(gcn::ActionEvent(NULL, mServerButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mServerButton->getActionEventId())); else if (key.getValue() == Key::ENTER) - action(gcn::ActionEvent(NULL, mLoginButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mLoginButton->getActionEventId())); else mLoginButton->setEnabled(canSubmit()); } diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index e42f12336..d890a462f 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -47,8 +47,8 @@ bool Minimap::mShow = true; Minimap::Minimap(): - Window(_("Map"), false, 0, "map.xml"), - mMapImage(0), + Window(_("Map"), false, nullptr, "map.xml"), + mMapImage(nullptr), mWidthProportion(0.5), mHeightProportion(0.5), mCustomMapImage(false), @@ -83,7 +83,7 @@ Minimap::~Minimap() delete mMapImage; else mMapImage->decRef(); - mMapImage = 0; + mMapImage = nullptr; } } @@ -107,7 +107,7 @@ void Minimap::setMap(Map *map) delete mMapImage; else mMapImage->decRef(); - mMapImage = 0; + mMapImage = nullptr; } if (map) diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index d307dfed0..665d2b61b 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -67,7 +67,7 @@ MiniStatusWindow::MiniStatusWindow(): } else { - mMpBar = 0; + mMpBar = nullptr; } int job = Net::getPlayerHandler()->getJobLocation() @@ -85,7 +85,7 @@ MiniStatusWindow::MiniStatusWindow(): } else { - mJobBar = 0; + mJobBar = nullptr; } mWeightBar = createBar(0, 140, 20, Theme::PROG_WEIGHT, @@ -124,9 +124,9 @@ MiniStatusWindow::MiniStatusWindow(): MiniStatusWindow::~MiniStatusWindow() { delete mTextPopup; - mTextPopup = 0; + mTextPopup = nullptr; delete mStatusPopup; - mStatusPopup = 0; + mStatusPopup = nullptr; delete_all(mIcons); mIcons.clear(); @@ -161,7 +161,7 @@ void MiniStatusWindow::updateBars() { int x = 0; std::vector <ProgressBar*>::const_iterator it, it_end; - ProgressBar* lastBar = 0; + ProgressBar* lastBar = nullptr; for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) safeRemove(*it); for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index b926d260e..66a30c8a7 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -55,14 +55,14 @@ NpcDialog::DialogList NpcDialog::instances; -NpcDialog::NpcDialog(int npcId) - : Window(_("NPC"), false, 0, "npc.xml"), - mNpcId(npcId), - mLogInteraction(config.getBoolValue("logNpcInGui")), - mDefaultInt(0), - mInputState(NPC_INPUT_NONE), - mActionState(NPC_ACTION_WAIT), - mLastNextTime(0) +NpcDialog::NpcDialog(int npcId) : + Window(_("NPC"), false, nullptr, "npc.xml"), + mNpcId(npcId), + mLogInteraction(config.getBoolValue("logNpcInGui")), + mDefaultInt(0), + mInputState(NPC_INPUT_NONE), + mActionState(NPC_ACTION_WAIT), + mLastNextTime(0) { // Basic Window Setup setWindowName("NpcText"); @@ -143,32 +143,32 @@ NpcDialog::~NpcDialog() clearLayout(); delete mTextBox; - mTextBox = 0; + mTextBox = nullptr; delete mClearButton; - mClearButton = 0; + mClearButton = nullptr; delete mButton; - mButton = 0; + mButton = nullptr; // These might not actually be in the layout, so lets be safe delete mScrollArea; - mScrollArea = 0; + mScrollArea = nullptr; delete mItemList; - mItemList = 0; + mItemList = nullptr; delete mTextField; - mTextField = 0; + mTextField = nullptr; delete mIntField; - mIntField = 0; + mIntField = nullptr; delete mResetButton; - mResetButton = 0; + mResetButton = nullptr; delete mPlusButton; - mPlusButton = 0; + mPlusButton = nullptr; delete mMinusButton; - mMinusButton = 0; + mMinusButton = nullptr; delete mItemLinkHandler; - mItemLinkHandler = 0; + mItemLinkHandler = nullptr; delete mListScrollArea; - mListScrollArea = 0; + mListScrollArea = nullptr; instances.remove(this); } @@ -432,7 +432,7 @@ NpcDialog *NpcDialog::getActive() return (*it); } - return 0; + return nullptr; } void NpcDialog::closeAll() diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 67fc57ba9..ada48e832 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -39,7 +39,7 @@ NpcPostDialog::DialogList NpcPostDialog::instances; NpcPostDialog::NpcPostDialog(int npcId): - Window(_("NPC"), false, 0, "npcpost.xml"), + Window(_("NPC"), false, nullptr, "npcpost.xml"), mNpcId(npcId) { setContentSize(400, 180); diff --git a/src/gui/okdialog.h b/src/gui/okdialog.h index 2ee8653ec..2f32d0d65 100644 --- a/src/gui/okdialog.h +++ b/src/gui/okdialog.h @@ -23,6 +23,8 @@ #ifndef OK_DIALOG_H #define OK_DIALOG_H +#include "localconsts.h" + #include "gui/widgets/window.h" #include <guichan/actionlistener.hpp> @@ -44,7 +46,7 @@ class OkDialog : public Window, public gcn::ActionListener */ OkDialog(const std::string &title, const std::string &msg, bool modal = true, bool showCenter = true, - Window *parent = NULL); + Window *parent = nullptr); /** * Called when receiving actions from the widgets. diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 8e0791af1..c33c753bc 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -57,13 +57,13 @@ float OutfitWindow::mAlpha = 1.0; OutfitWindow::OutfitWindow(): - Window(_("Outfits"), false, 0, "outfits.xml"), + Window(_("Outfits"), false, nullptr, "outfits.xml"), mBoxWidth(33), mBoxHeight(33), mGridWidth(4), mGridHeight(3), mItemClicked(false), - mItemMoved(NULL), + mItemMoved(nullptr), mItemSelected(-1), mItemColorSelected(1), mCurrentOutfit(0), @@ -383,7 +383,7 @@ void OutfitWindow::mouseDragged(gcn::MouseEvent &event) if (item) mItemMoved = item; else - mItemMoved = 0; + mItemMoved = nullptr; mItems[mCurrentOutfit][index] = -1; } } @@ -433,7 +433,7 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event) const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) { - mItemMoved = NULL; + mItemMoved = nullptr; Window::mouseReleased(event); return; } @@ -443,7 +443,7 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event) { mItems[mCurrentOutfit][index] = mItemMoved->getId(); mItemColors[mCurrentOutfit][index] = mItemMoved->getColor(); - mItemMoved = NULL; + mItemMoved = nullptr; } if (mItemClicked) mItemClicked = false; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index a457573ce..b133f66fc 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -85,15 +85,15 @@ std::string tradePartnerName(""); PopupMenu::PopupMenu(): Popup("PopupMenu", "popupmenu.xml"), mBeingId(0), - mFloorItem(0), - mItem(0), + mFloorItem(nullptr), + mItem(nullptr), mItemId(0), mItemColor(1), - mMapItem(0), - mTab(0), - mSpell(0), - mDialog(0), - mButton(0), + mMapItem(nullptr), + mTab(nullptr), + mSpell(nullptr), + mDialog(nullptr), + mButton(nullptr), mNick(""), mType(Being::UNKNOWN) { @@ -102,10 +102,10 @@ PopupMenu::PopupMenu(): mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND); mBrowserBox->setOpaque(false); mBrowserBox->setLinkHandler(this); - mRenameListener.setMapItem(0); - mRenameListener.setDialog(0); + mRenameListener.setMapItem(nullptr); + mRenameListener.setDialog(nullptr); mPlayerListener.setNick(""); - mPlayerListener.setDialog(0); + mPlayerListener.setDialog(nullptr); mPlayerListener.setType(Being::UNKNOWN); add(mBrowserBox); @@ -833,9 +833,9 @@ void PopupMenu::showChangePos(int x, int y) else { mBeingId = 0; - mFloorItem = 0; - mItem = 0; - mMapItem = 0; + mFloorItem = nullptr; + mItem = nullptr; + mMapItem = nullptr; mNick = ""; mType = Being::UNKNOWN; setVisible(false); @@ -1683,11 +1683,11 @@ void PopupMenu::handleLink(const std::string &link, setVisible(false); mBeingId = 0; - mFloorItem = 0; - mItem = 0; + mFloorItem = nullptr; + mItem = nullptr; mItemId = 0; mItemColor = 1; - mMapItem = 0; + mMapItem = nullptr; mNick = ""; mType = Being::UNKNOWN; } @@ -1790,7 +1790,7 @@ void PopupMenu::showItemPopup(int x, int y, int itemId, unsigned char color) } else { - mItem = 0; + mItem = nullptr; mItemId = itemId; mItemColor = color; mBrowserBox->clearRows(); @@ -2066,8 +2066,8 @@ void PopupMenu::showPopup(int x, int y) } RenameListener::RenameListener() : - mMapItem(0), - mDialog(0) + mMapItem(nullptr), + mDialog(nullptr) { } @@ -2080,7 +2080,7 @@ void RenameListener::action(const gcn::ActionEvent &event) return; SpecialLayer *sl = map->getSpecialLayer(); - MapItem *item = 0; + MapItem *item = nullptr; if (sl) { item = sl->getTile(mMapItem->getX(), mMapItem->getY()); @@ -2099,12 +2099,12 @@ void RenameListener::action(const gcn::ActionEvent &event) if (socialWindow) socialWindow->updatePortalNames(); } - mDialog = 0; + mDialog = nullptr; } PlayerListener::PlayerListener() : mNick(""), - mDialog(0), + mDialog(nullptr), mType(Being::UNKNOWN) { } @@ -2120,5 +2120,5 @@ void PlayerListener::action(const gcn::ActionEvent &event) being->setComment(comment); Being::saveComment(mNick, comment, mType); } - mDialog = 0; + mDialog = nullptr; } diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 1307e198f..0f4d7f6f7 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -44,7 +44,7 @@ #include "debug.h" QuitDialog::QuitDialog(QuitDialog** pointerToMe): - Window(_("Quit"), true, 0, "quit.xml"), + Window(_("Quit"), true, nullptr, "quit.xml"), mMyPointer(pointerToMe) { mForceQuit = new RadioButton(_("Quit"), "quitdialog"); @@ -98,16 +98,16 @@ QuitDialog::QuitDialog(QuitDialog** pointerToMe): QuitDialog::~QuitDialog() { if (mMyPointer) - *mMyPointer = 0; + *mMyPointer = nullptr; // Optional widgets, so delete them by hand. delete mForceQuit; - mForceQuit = 0; + mForceQuit = nullptr; delete mLogoutQuit; - mLogoutQuit = 0; + mLogoutQuit = nullptr; delete mSwitchAccountServer; - mSwitchAccountServer = 0; + mSwitchAccountServer = nullptr; delete mSwitchCharacter; - mSwitchCharacter = 0; + mSwitchCharacter = nullptr; } void QuitDialog::placeOption(ContainerPlacer &placer, gcn::RadioButton *option) @@ -162,10 +162,10 @@ void QuitDialog::keyPressed(gcn::KeyEvent &keyEvent) switch (key.getValue()) { case Key::ENTER: - action(gcn::ActionEvent(NULL, mOkButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mOkButton->getActionEventId())); break; case Key::ESCAPE: - action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId())); break; case Key::UP: dir = -1; diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 062275b80..29030aa72 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -47,7 +47,7 @@ #include "debug.h" WrongDataNoticeListener::WrongDataNoticeListener(): - mTarget(0) + mTarget(nullptr) { } @@ -63,10 +63,10 @@ void WrongDataNoticeListener::action(const gcn::ActionEvent &event) } RegisterDialog::RegisterDialog(LoginData *data): - Window(_("Register"), false, 0, "register.xml"), - mEmailField(0), - mMaleButton(0), - mFemaleButton(0), + Window(_("Register"), false, nullptr, "register.xml"), + mEmailField(nullptr), + mMaleButton(nullptr), + mFemaleButton(nullptr), mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { @@ -147,7 +147,7 @@ RegisterDialog::RegisterDialog(LoginData *data): RegisterDialog::~RegisterDialog() { delete mWrongDataNoticeListener; - mWrongDataNoticeListener = 0; + mWrongDataNoticeListener = nullptr; } void RegisterDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index b196ae4e4..001a8671a 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -49,14 +49,14 @@ class SDLTextChunk { public: SDLTextChunk(const std::string &text0, const gcn::Color &color0) : - img(0), text(text0), color(color0) + img(nullptr), text(text0), color(color0) { } ~SDLTextChunk() { delete img; - img = 0; + img = nullptr; } bool operator==(const SDLTextChunk &chunk) const @@ -79,7 +79,7 @@ class SDLTextChunk if (!surface) { - img = 0; + img = nullptr; return; } @@ -138,7 +138,7 @@ SDLFont::SDLFont(const std::string &filename, int size, int style) : SDLFont::~SDLFont() { TTF_CloseFont(mFont); - mFont = 0; + mFont = nullptr; --fontCounter; if (fontCounter == 0) diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index bbd0a71c1..e1a77f6c9 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -50,14 +50,14 @@ SellDialog::DialogList SellDialog::instances; SellDialog::SellDialog(int npcId): - Window(_("Sell"), false, 0, "sell.xml"), + Window(_("Sell"), false, nullptr, "sell.xml"), mNpcId(npcId), mMaxItems(0), mAmountItems(0), mNick("") { init(); } SellDialog::SellDialog(std::string nick): - Window(_("Sell"), false, 0, "sell.xml"), + Window(_("Sell"), false, nullptr, "sell.xml"), mNpcId(-1), mMaxItems(0), mAmountItems(0), mNick(nick) { init(); @@ -133,7 +133,7 @@ void SellDialog::init() SellDialog::~SellDialog() { delete mShopItems; - mShopItems = 0; + mShopItems = nullptr; instances.remove(this); } @@ -290,7 +290,7 @@ void SellDialog::updateButtonsAndLabels() { int selectedItem = mShopItemList->getSelected(); int income = 0; - ShopItem *item = 0; + ShopItem *item = nullptr; if (selectedItem > -1 && mShopItems->at(selectedItem)) { diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 5a00d4a76..3fd298159 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -234,15 +234,15 @@ private: ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): - Window(_("Choose Your Server"), false, 0, "server.xml"), + Window(_("Choose Your Server"), false, nullptr, "server.xml"), mDir(dir), // mDownloadStatus(DOWNLOADING_PREPARING), mDownloadStatus(DOWNLOADING_UNKNOWN), - mDownload(0), + mDownload(nullptr), mDownloadProgress(-1.0f), mServers(ServerInfos()), mServerInfo(serverInfo), - mPersistentIPCheckBox(0) + mPersistentIPCheckBox(nullptr) { if (isSafeMode) setCaption(_("Choose Your Server *** SAFE MODE ***")); @@ -377,12 +377,12 @@ ServerDialog::~ServerDialog() { mDownload->cancel(); delete mDownload; - mDownload = 0; + mDownload = nullptr; } delete mServersListModel; - mServersListModel = 0; + mServersListModel = nullptr; delete mTypeListModel; - mTypeListModel = 0; + mTypeListModel = nullptr; } void ServerDialog::action(const gcn::ActionEvent &event) @@ -489,7 +489,7 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) if (key.getValue() == Key::ESCAPE) Client::setState(STATE_EXIT); else if (key.getValue() == Key::ENTER) - action(gcn::ActionEvent(NULL, mConnectButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mConnectButton->getActionEventId())); } void ServerDialog::valueChanged(const gcn::SelectionEvent &) @@ -617,7 +617,7 @@ void ServerDialog::downloadServerList() { mDownload->cancel(); delete mDownload; - mDownload = 0; + mDownload = nullptr; } mDownload = new Net::Download(this, listFile, &downloadUpdate); diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index ae7a3109c..d305824d5 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -51,7 +51,7 @@ extern Window *statusWindow; Setup::Setup(): - Window(_("Setup"), false, 0, "setup.xml") + Window(_("Setup"), false, nullptr, "setup.xml") { setCloseButton(true); setResizable(true); @@ -72,7 +72,7 @@ Setup::Setup(): N_("Cancel"), N_("Store"), N_("Reset Windows"), - 0 + nullptr }; int x = width; for (const char **curBtn = buttonNames; *curBtn; ++curBtn) diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index 7c0306f8f..6f1a4afce 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -65,7 +65,7 @@ Setup_Colors::Setup_Colors() : mPreview->setOpaque(false); // don't do anything with links - mPreview->setLinkHandler(NULL); + mPreview->setLinkHandler(nullptr); mPreviewBox = new ScrollArea(mPreview); mPreviewBox->setHeight(20); @@ -188,12 +188,12 @@ Setup_Colors::~Setup_Colors() if (mPreviewBox && mPreviewBox->getContent() == mPreview) { delete mTextPreview; - mTextPreview = 0; + mTextPreview = nullptr; } else { delete mPreview; - mPreview = 0; + mPreview = nullptr; } } @@ -251,7 +251,7 @@ void Setup_Colors::valueChanged(const gcn::SelectionEvent &event A_UNUSED) mPreviewBox->setContent(mTextPreview); mTextPreview->setFont(boldFont); mTextPreview->setTextColor(col); - mTextPreview->setTextBGColor(NULL); + mTextPreview->setTextBGColor(nullptr); mTextPreview->setOpaque(false); mTextPreview->setShadow(true); mTextPreview->setOutline(true); diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index 922d9797b..fa7a63b8c 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -112,16 +112,16 @@ Setup_Keyboard::Setup_Keyboard(): Setup_Keyboard::~Setup_Keyboard() { delete mKeyList; - mKeyList = 0; + mKeyList = nullptr; delete mKeyListModel; - mKeyListModel = 0; + mKeyListModel = nullptr; delete mAssignKeyButton; - mAssignKeyButton = 0; + mAssignKeyButton = nullptr; delete mUnassignKeyButton; - mUnassignKeyButton = 0; + mUnassignKeyButton = nullptr; delete mMakeDefaultButton; - mMakeDefaultButton = 0; + mMakeDefaultButton = nullptr; } void Setup_Keyboard::apply() diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 73fd34e27..1921ee267 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -98,7 +98,7 @@ class PlayerTableModel : public TableModel { public: PlayerTableModel() : - mPlayers(NULL), + mPlayers(nullptr), mListModel(new PlayerRelationListModel) { playerRelationsUpdated(); diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index 04d4c5412..3b1c1d932 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -155,7 +155,7 @@ const Language LANG_NAME[langs_count] = {N_("Portuguese"), "pt_PT"}, {N_("Portuguese (Brazilian)"), "pt_BR"}, {N_("Russian"), "ru_RU"}, - {N_("Spanish (Castilian)"), "es_ES"}, + {N_("Spanish (Castilian)"), "es_ES"} }; class LangListModel : public gcn::ListModel @@ -302,16 +302,16 @@ Setup_Theme::Setup_Theme(): Setup_Theme::~Setup_Theme() { delete mThemesModel; - mThemesModel = 0; + mThemesModel = nullptr; delete mFontsModel; - mFontsModel = 0; + mFontsModel = nullptr; delete mFontSizeListModel; - mFontSizeListModel = 0; + mFontSizeListModel = nullptr; delete mLangListModel; - mLangListModel = 0; + mLangListModel = nullptr; } void Setup_Theme::action(const gcn::ActionEvent &event) diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index d3c1163dc..ea181ea14 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -130,7 +130,7 @@ bool modeSorter(std::string mode1, std::string mode2) ModeListModel::ModeListModel() { /* Get available fullscreen/hardware modes */ - SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); + SDL_Rect **modes = SDL_ListModes(nullptr, SDL_FULLSCREEN | SDL_HWSURFACE); /* Check which modes are available */ if (modes == static_cast<SDL_Rect **>(0)) diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 6d48da197..eff28def7 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -54,7 +54,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, ShortcutContainer *content, std::string skinFile, int width, int height) : - Window("Window", false, 0, skinFile) + Window("Window", false, nullptr, skinFile) { setWindowName(title); // no title presented, title bar is padding so window can be moved. @@ -66,7 +66,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, setupWindow->registerWindowForReset(this); - mTabs = 0; + mTabs = nullptr; mItems = content; const int border = SCROLL_PADDING * 2 + getPadding() * 2; @@ -100,7 +100,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile, int width, int height) : - Window("Window", false, 0, skinFile) + Window("Window", false, nullptr, skinFile) { setWindowName(title); // no title presented, title bar is padding so window can be moved. @@ -114,7 +114,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile, mTabs = new TabbedArea; - mItems = 0; + mItems = nullptr; const int border = SCROLL_PADDING * 2 + getPadding() * 2; @@ -138,9 +138,9 @@ ShortcutWindow::~ShortcutWindow() if (mTabs) mTabs->removeAll(); delete mTabs; - mTabs = 0; + mTabs = nullptr; delete mItems; - mItems = 0; + mItems = nullptr; } void ShortcutWindow::addTab(std::string name, ShortcutContainer *content) diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index a728d4051..6b07e109f 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -79,14 +79,14 @@ protected: { mInviteDialog->close(); mInviteDialog->scheduleDelete(); - mInviteDialog = NULL; + mInviteDialog = nullptr; } if (mConfirmDialog) { mConfirmDialog->close(); mConfirmDialog->scheduleDelete(); - mConfirmDialog = NULL; + mConfirmDialog = nullptr; } } @@ -347,11 +347,11 @@ public: localChatTab->chatLog(strprintf(_("Invited user %s to party."), name.c_str()), BY_SERVER); } - mInviteDialog = NULL; + mInviteDialog = nullptr; } else if (event.getId() == "~do invite") { - mInviteDialog = NULL; + mInviteDialog = nullptr; } else if (event.getId() == "yes") { @@ -361,11 +361,11 @@ public: localChatTab->chatLog(strprintf(_("Party %s quit requested."), mParty->getName().c_str()), BY_SERVER); } - mConfirmDialog = NULL; + mConfirmDialog = nullptr; } else if (event.getId() == "~yes") { - mConfirmDialog = NULL; + mConfirmDialog = nullptr; } } @@ -1146,7 +1146,7 @@ SocialWindow::SocialWindow() : place(2, 0, mLeaveButton); place(0, 1, mTabs, 4, 4); - widgetResized(NULL); + widgetResized(nullptr); mCreatePopup = new CreatePopup(); @@ -1184,7 +1184,7 @@ SocialWindow::~SocialWindow() { mGuildAcceptDialog->close(); mGuildAcceptDialog->scheduleDelete(); - mGuildAcceptDialog = NULL; + mGuildAcceptDialog = nullptr; mGuildInvited = 0; } @@ -1193,7 +1193,7 @@ SocialWindow::~SocialWindow() { mPartyAcceptDialog->close(); mPartyAcceptDialog->scheduleDelete(); - mPartyAcceptDialog = NULL; + mPartyAcceptDialog = nullptr; mPartyInviter = ""; } @@ -1300,7 +1300,7 @@ void SocialWindow::action(const gcn::ActionEvent &event) } mPartyInviter = ""; - mPartyAcceptDialog = NULL; + mPartyAcceptDialog = nullptr; } else if (event.getSource() == mGuildAcceptDialog) { @@ -1333,7 +1333,7 @@ void SocialWindow::action(const gcn::ActionEvent &event) } mGuildInvited = 0; - mGuildAcceptDialog = NULL; + mGuildAcceptDialog = nullptr; } else if (event.getId() == "create") { @@ -1374,11 +1374,11 @@ void SocialWindow::action(const gcn::ActionEvent &event) name.c_str()), BY_SERVER); } - mGuildCreateDialog = NULL; + mGuildCreateDialog = nullptr; } else if (event.getId() == "~create guild") { - mGuildCreateDialog = NULL; + mGuildCreateDialog = nullptr; } else if (event.getId() == "create party") { @@ -1397,11 +1397,11 @@ void SocialWindow::action(const gcn::ActionEvent &event) name.c_str()), BY_SERVER); } - mPartyCreateDialog = NULL; + mPartyCreateDialog = nullptr; } else if (event.getId() == "~create party") { - mPartyCreateDialog = NULL; + mPartyCreateDialog = nullptr; } } diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index c464b83b5..a52b30c62 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -194,10 +194,10 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData) SpecialEntry::SpecialEntry(SpecialInfo *info) : mInfo(info), - mIcon(NULL), - mLevelLabel(NULL), - mUse(NULL), - mRechargeBar(NULL) + mIcon(nullptr), + mLevelLabel(nullptr), + mUse(nullptr), + mRechargeBar(nullptr) { setFrameSize(1); setOpaque(false); diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 6512f8465..7d97549f3 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -165,7 +165,7 @@ public: TextCommandEditor::TextCommandEditor(TextCommand *command): - Window(_("Command Editor"), false, 0, "commandeditor.xml") + Window(_("Command Editor"), false, nullptr, "commandeditor.xml") { int w = 350; int h = 370; @@ -302,11 +302,11 @@ TextCommandEditor::TextCommandEditor(TextCommand *command): TextCommandEditor::~TextCommandEditor() { delete mIconsModal; - mIconsModal = 0; + mIconsModal = nullptr; delete mTargetTypeModel; - mTargetTypeModel = 0; + mTargetTypeModel = nullptr; delete mMagicSchoolModel; - mMagicSchoolModel = 0; + mMagicSchoolModel = nullptr; } void TextCommandEditor::action(const gcn::ActionEvent &event) diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 2efe82199..b605d30df 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -147,8 +147,8 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, mDownloadComplete(true), mUserCancel(false), mDownloadedBytes(0), - mMemoryBuffer(NULL), - mDownload(NULL), + mMemoryBuffer(nullptr), + mDownload(nullptr), mUpdateIndex(0), mUpdateIndexOffset(0), mLoadUpdates(applyUpdates), @@ -256,7 +256,7 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent) if (key.getValue() == Key::ESCAPE) { - action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId())); Client::setState(STATE_WORLD_SELECT); } else if (key.getValue() == Key::ENTER) @@ -264,11 +264,11 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent) if (mDownloadStatus == UPDATE_COMPLETE || mDownloadStatus == UPDATE_ERROR) { - action(gcn::ActionEvent(NULL, mPlayButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mPlayButton->getActionEventId())); } else { - action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId())); } } } @@ -294,12 +294,12 @@ void UpdaterWindow::loadNews() while (line) { mBrowserBox->addRow(line); - line = strtok(NULL, "\n"); + line = strtok(nullptr, "\n"); } // Free the memory buffer now that we don't need it anymore free(mMemoryBuffer); - mMemoryBuffer = NULL; + mMemoryBuffer = nullptr; mDownloadedBytes = 0; mScrollArea->setVerticalScrollAmount(0); @@ -340,7 +340,7 @@ void UpdaterWindow::loadPatch() // Free the memory buffer now that we don't need it anymore free(mMemoryBuffer); - mMemoryBuffer = NULL; + mMemoryBuffer = nullptr; mDownloadedBytes = 0; mScrollArea->setVerticalScrollAmount(0); @@ -365,7 +365,7 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status, uw->mDownloadStatus = UPDATE_COMPLETE; uw->mDownloadComplete = true; free(uw->mMemoryBuffer); - uw->mMemoryBuffer = NULL; + uw->mMemoryBuffer = nullptr; } else { diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 97a467add..13c0a8cc0 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -298,8 +298,8 @@ void Viewport::_followMouse() if (mPlayerFollowMouse && button & SDL_BUTTON(1)) { // We create a mouse event and send it to mouseDragged. - Uint8 *keys = SDL_GetKeyState(NULL); - gcn::MouseEvent mouseEvent(NULL, + Uint8 *keys = SDL_GetKeyState(nullptr); + gcn::MouseEvent mouseEvent(nullptr, (keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT]), false, false, diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 3fb63a105..b6d67fa83 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -83,11 +83,11 @@ class NameFunctuator WhoIsOnline::WhoIsOnline(): Window(_("Who Is Online - Updating"), false, 0, "whoisonline.xml"), - mThread(NULL), + mThread(nullptr), mDownloadStatus(UPDATE_LIST), mDownloadComplete(true), mDownloadedBytes(0), - mMemoryBuffer(NULL), + mMemoryBuffer(nullptr), mCurlError(new char[CURL_ERROR_SIZE]), mAllowUpdate(true), mShowLevel(false) @@ -137,7 +137,7 @@ WhoIsOnline::~WhoIsOnline() config.removeListener("updateOnlineList", this); if (mThread && SDL_GetThreadID(mThread)) - SDL_WaitThread(mThread, NULL); + SDL_WaitThread(mThread, nullptr); free(mMemoryBuffer); mMemoryBuffer = 0; @@ -206,7 +206,7 @@ void WhoIsOnline::loadList() mShowLevel = config.getBoolValue("showlevel"); - while (line != NULL) + while (line) { std::string nick; lineStr = line; @@ -295,7 +295,7 @@ void WhoIsOnline::loadList() { listStarted = true; } - line = strtok(NULL, "\n"); + line = strtok(nullptr, "\n"); } //Set window caption @@ -448,12 +448,12 @@ void WhoIsOnline::download() { mDownloadComplete = true; if (mThread && SDL_GetThreadID(mThread)) - SDL_WaitThread(mThread, NULL); + SDL_WaitThread(mThread, nullptr); mDownloadComplete = false; mThread = SDL_CreateThread(WhoIsOnline::downloadThread, this); - if (mThread == NULL) + if (mThread == nullptr) mDownloadStatus = UPDATE_ERROR; } @@ -525,8 +525,8 @@ void WhoIsOnline::action(const gcn::ActionEvent &event) setCaption(_("Who Is Online - Update")); if (mThread && SDL_GetThreadID(mThread)) { - SDL_WaitThread(mThread, NULL); - mThread = NULL; + SDL_WaitThread(mThread, nullptr); + mThread = nullptr; } mDownloadComplete = true; } diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 18dc48417..8264f0fb9 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -43,8 +43,8 @@ #include "debug.h" int AvatarListBox::instances = 0; -Image *AvatarListBox::onlineIcon = 0; -Image *AvatarListBox::offlineIcon = 0; +Image *AvatarListBox::onlineIcon = nullptr; +Image *AvatarListBox::offlineIcon = nullptr; AvatarListBox::AvatarListBox(AvatarListModel *model): ListBox(model), @@ -83,12 +83,12 @@ AvatarListBox::~AvatarListBox() if (onlineIcon) { onlineIcon->decRef(); - onlineIcon = 0; + onlineIcon = nullptr; } if (offlineIcon) { offlineIcon->decRef(); - offlineIcon = 0; + offlineIcon = nullptr; } } } diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 5b862d16c..5ded29c55 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -49,8 +49,9 @@ BrowserBox::BrowserBox(unsigned int mode, bool opaque): gcn::Widget(), - mLinkHandler(0), - mMode(mode), mHighMode(UNDERLINE | BACKGROUND), + mLinkHandler(nullptr), + mMode(mode), + mHighMode(UNDERLINE | BACKGROUND), mOpaque(opaque), mUseLinksAndUserColors(true), mSelectedLink(-1), @@ -648,5 +649,5 @@ LinePart::~LinePart() { if (mImage) mImage->decRef(); - mImage = 0; + mImage = nullptr; } diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index cf2f9c1f1..06609b318 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -30,6 +30,8 @@ #include <list> #include <vector> +#include "localconsts.h" + class Image; class Resource; class LinkHandler; @@ -46,7 +48,7 @@ class LinePart public: LinePart(int x, int y, gcn::Color color, std::string text, bool bold) : mX(x), mY(y), mColor(color), mText(text), mType(0), - mImage(0), mBold(bold) + mImage(nullptr), mBold(bold) { } diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 7c46ae9df..85e4eca17 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -146,7 +146,7 @@ Button::~Button() mInstances--; delete mVertexes; - mVertexes = 0; + mVertexes = nullptr; if (mInstances == 0) { for (int mode = 0; mode < BUTTON_COUNT; mode++) diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 9a29ae204..0a224605a 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -82,9 +82,9 @@ ChatTab::~ChatTab() chatWindow->removeTab(this); delete mTextOutput; - mTextOutput = 0; + mTextOutput = nullptr; delete mScrollArea; - mScrollArea = 0; + mScrollArea = nullptr; } void ChatTab::chatLog(std::string line, Own own, diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 65d26e196..dcedc8951 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -70,12 +70,12 @@ CheckBox::CheckBox(const std::string &caption, bool selected, } else { - checkBoxNormal = 0; - checkBoxChecked = 0; - checkBoxDisabled = 0; - checkBoxDisabledChecked = 0; - checkBoxNormalHi = 0; - checkBoxCheckedHi = 0; + checkBoxNormal = nullptr; + checkBoxChecked = nullptr; + checkBoxDisabled = nullptr; + checkBoxDisabledChecked = nullptr; + checkBoxNormalHi = nullptr; + checkBoxCheckedHi = nullptr; } } @@ -97,17 +97,17 @@ CheckBox::~CheckBox() if (instances == 0) { delete checkBoxNormal; - checkBoxNormal = 0; + checkBoxNormal = nullptr; delete checkBoxChecked; - checkBoxChecked = 0; + checkBoxChecked = nullptr; delete checkBoxDisabled; - checkBoxDisabled = 0; + checkBoxDisabled = nullptr; delete checkBoxDisabledChecked; - checkBoxDisabledChecked = 0; + checkBoxDisabledChecked = nullptr; delete checkBoxNormalHi; - checkBoxNormalHi = 0; + checkBoxNormalHi = nullptr; delete checkBoxCheckedHi; - checkBoxCheckedHi = 0; + checkBoxCheckedHi = nullptr; } } diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index a16ab242c..4e293aad6 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -25,6 +25,8 @@ #include <guichan/widgets/checkbox.hpp> +#include "localconsts.h" + #ifdef __GNUC__ #define A_UNUSED __attribute__ ((unused)) #else @@ -45,7 +47,7 @@ class CheckBox : public gcn::CheckBox * Constructor. */ CheckBox(const std::string &caption, bool selected = false, - gcn::ActionListener* listener = NULL, + gcn::ActionListener* listener = nullptr, std::string eventId = ""); /** diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 46240f76d..beb232fb2 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -39,7 +39,7 @@ #include "debug.h" Desktop::Desktop() : - mWallpaper(0) + mWallpaper(nullptr) { addWidgetListener(this); @@ -66,7 +66,7 @@ Desktop::~Desktop() if (mWallpaper) { mWallpaper->decRef(); - mWallpaper = 0; + mWallpaper = nullptr; } } diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 687d7dc6d..2a17320de 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -133,7 +133,7 @@ DropDown::~DropDown() } delete mScrollArea; - mScrollArea = 0; + mScrollArea = nullptr; } void DropDown::updateAlpha() diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 4cbd23314..3559b634a 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -25,6 +25,8 @@ #include <guichan/widgets/dropdown.hpp> +#include "localconsts.h" + class Image; class ImageRect; @@ -47,7 +49,7 @@ class DropDown : public gcn::DropDown * @see ListModel, ScrollArea, ListBox. */ DropDown(gcn::ListModel *listModel = 0, - gcn::ActionListener* listener = NULL, + gcn::ActionListener* listener = nullptr, std::string eventId = ""); ~DropDown(); diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 1fa272448..8335a61bc 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -49,7 +49,7 @@ DropShortcutContainer::DropShortcutContainer(): ShortcutContainer(), mItemClicked(false), - mItemMoved(NULL) + mItemMoved(nullptr) { addMouseListener(this); addWidgetListener(this); @@ -82,10 +82,10 @@ DropShortcutContainer::~DropShortcutContainer() if (mBackgroundImg) { mBackgroundImg->decRef(); - mBackgroundImg = 0; + mBackgroundImg = nullptr; } delete mItemPopup; - mItemPopup = 0; + mItemPopup = nullptr; } void DropShortcutContainer::draw(gcn::Graphics *graphics) @@ -254,14 +254,14 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event) const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) { - mItemMoved = NULL; + mItemMoved = nullptr; return; } if (mItemMoved) { dropShortcut->setItems(index, mItemMoved->getId(), mItemMoved->getColor()); - mItemMoved = NULL; + mItemMoved = nullptr; } if (mItemClicked) diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index cc9e8badf..e8d7bb7e3 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -90,7 +90,7 @@ EmoteShortcutContainer::~EmoteShortcutContainer() if (mBackgroundImg) { mBackgroundImg->decRef(); - mBackgroundImg = 0; + mBackgroundImg = nullptr; } } diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp index 0a64a7142..7d3ddc0b4 100644 --- a/src/gui/widgets/flowcontainer.cpp +++ b/src/gui/widgets/flowcontainer.cpp @@ -87,5 +87,5 @@ void FlowContainer::add(gcn::Widget *widget) Container::add(widget); widget->setSize(mBoxWidth, mBoxHeight); - widgetResized(NULL); + widgetResized(nullptr); } diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index e02eda88c..78ce14e56 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -76,7 +76,7 @@ GuiTableActionListener::~GuiTableActionListener() if (mWidget) { mWidget->removeActionListener(this); - mWidget->_setParent(NULL); + mWidget->_setParent(nullptr); } } @@ -92,10 +92,10 @@ GuiTable::GuiTable(TableModel *initial_model, bool opacity) : mLinewiseMode(false), mWrappingEnabled(false), mOpaque(opacity), - mModel(NULL), + mModel(nullptr), mSelectedRow(0), mSelectedColumn(0), - mTopWidget(NULL) + mTopWidget(nullptr) { mBackgroundColor = Theme::getThemeColor(Theme::BACKGROUND); mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT); @@ -110,7 +110,7 @@ GuiTable::~GuiTable() { uninstallActionListeners(); delete mModel; - mModel = 0; + mModel = nullptr; } TableModel *GuiTable::getModel() const @@ -391,7 +391,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget) { gcn::Widget::moveToBottom(widget); if (widget == mTopWidget) - mTopWidget = NULL; + mTopWidget = nullptr; } gcn::Rectangle GuiTable::getChildrenArea() @@ -512,7 +512,7 @@ void GuiTable::modelUpdated(bool completed) } else { // before the update? - mTopWidget = NULL; // No longer valid in general + mTopWidget = nullptr; // No longer valid in general uninstallActionListeners(); } } @@ -531,10 +531,10 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y) if (w && w->isFocusable()) return w; else - return NULL; // Grab the event locally + return nullptr; // Grab the event locally } else - return NULL; + return nullptr; } int GuiTable::getRowForY(int y) const diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index d248c4820..cf3cb8ad8 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -23,6 +23,8 @@ #ifndef TABLE_H #define TABLE_H +#include "localconsts.h" + #include "gui/widgets/tablemodel.h" #include <guichan/keylistener.hpp> @@ -57,7 +59,7 @@ class GuiTable : public gcn::Widget, friend class GuiTableActionListener; public: - GuiTable(TableModel * initial_model = NULL, + GuiTable(TableModel * initial_model = nullptr, bool opacity = true); virtual ~GuiTable(); diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 3e9c7dd24..b8cc2ac3a 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -30,7 +30,7 @@ #include "debug.h" Icon::Icon(const std::string &file) - : mImage(0) + : mImage(nullptr) { mImage = ResourceManager::getInstance()->getImage(file); if (mImage) diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 9a17d81cd..57c64093b 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -166,7 +166,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mDescItems(false), mTag(0), mSortType(0), - mShowMatrix(0) + mShowMatrix(nullptr) { mItemPopup = new ItemPopup; setFocusable(true); @@ -188,10 +188,10 @@ ItemContainer::~ItemContainer() if (mSelImg) { mSelImg->decRef(); - mSelImg = 0; + mSelImg = nullptr; } delete mItemPopup; - mItemPopup = 0; + mItemPopup = nullptr; delete []mShowMatrix; } @@ -309,7 +309,7 @@ Item *ItemContainer::getSelectedItem() const if (mInventory) return mInventory->getItem(mSelectedIndex); else - return 0; + return nullptr; } void ItemContainer::distributeValueChangedEvent() diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 6ae0f6b5b..549aa1616 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -42,7 +42,7 @@ ItemLinkHandler::ItemLinkHandler() ItemLinkHandler::~ItemLinkHandler() { delete mItemPopup; - mItemPopup = 0; + mItemPopup = nullptr; } void ItemLinkHandler::handleLink(const std::string &link, diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 560045a29..3682ec448 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -51,7 +51,7 @@ ItemShortcutContainer::ItemShortcutContainer(unsigned number): ShortcutContainer(), mItemClicked(false), - mItemMoved(NULL), + mItemMoved(nullptr), mNumber(number) { addMouseListener(this); @@ -87,12 +87,12 @@ ItemShortcutContainer::~ItemShortcutContainer() if (mBackgroundImg) { mBackgroundImg->decRef(); - mBackgroundImg = 0; + mBackgroundImg = nullptr; } delete mItemPopup; - mItemPopup = 0; + mItemPopup = nullptr; delete mSpellPopup; - mSpellPopup = 0; + mSpellPopup = nullptr; } void ItemShortcutContainer::draw(gcn::Graphics *graphics) @@ -304,14 +304,14 @@ void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event) const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) { - mItemMoved = NULL; + mItemMoved = nullptr; return; } if (mItemMoved) { itemShortcut[mNumber]->setItems(index, mItemMoved->getId(), mItemMoved->getColor()); - mItemMoved = NULL; + mItemMoved = nullptr; } else if (itemShortcut[mNumber]->getItem(index) && mItemClicked) { diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index 52b92d0bc..7f2f1f621 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -45,7 +45,7 @@ LayoutCell::~LayoutCell() if (mType == ARRAY) { delete mArray; - mArray = 0; + mArray = nullptr; } } @@ -159,7 +159,7 @@ void LayoutArray::resizeGrid(int w, int h) i = mCells.begin(); while (i != mCells.end()) { - i->resize(w, 0); + i->resize(w, nullptr); ++i; } } diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 5e3ac4532..c4c703644 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -23,6 +23,8 @@ #ifndef WIDGET_LAYOUT_H #define WIDGET_LAYOUT_H +#include "localconsts.h" + #include <guichan/widgets/container.hpp> #include <vector> @@ -35,7 +37,7 @@ class LayoutCell; class ContainerPlacer { public: - ContainerPlacer(gcn::Container *c = NULL, LayoutCell *l = NULL): + ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *l = nullptr): mContainer(c), mCell(l) {} @@ -172,7 +174,7 @@ class LayoutCell }; LayoutCell(): - mWidget(0), + mWidget(nullptr), mHPadding(0), mVPadding(0), mType(NONE) diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 2efaa2088..fb72176bd 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -68,7 +68,7 @@ PlayerBox::PlayerBox(const Being *being): } else { - background.grid[a] = 0; + background.grid[a] = nullptr; } a++; } @@ -85,7 +85,7 @@ PlayerBox::~PlayerBox() { instances--; - mBeing = 0; + mBeing = nullptr; if (instances == 0) for_each(background.grid, background.grid + 9, dtor<Image*>()); diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index 1b1a237d8..2bf010618 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -52,7 +52,8 @@ class PlayerBox : public gcn::ScrollArea * player to <code>NULL</code> causes the box not to draw any * character. */ - void setPlayer(const Being *being) { mBeing = being; } + void setPlayer(const Being *being) + { mBeing = being; } /** * Draws the scroll area. diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index ac282b088..78557d481 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -70,7 +70,7 @@ Popup::Popup(const std::string &name, std::string skin): } else { - mSkin = 0; + mSkin = nullptr; } // Add this window to the window container @@ -85,13 +85,13 @@ Popup::~Popup() logger->log("Popup::~Popup(\"%s\")", mPopupName.c_str()); delete mVertexes; - mVertexes = 0; + mVertexes = nullptr; if (mSkin) { if (Theme::instance()) Theme::instance()->unload(mSkin); - mSkin = 0; + mSkin = nullptr; } } diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 7324fc9ad..f9b6da153 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -93,7 +93,7 @@ ProgressBar::ProgressBar(float progress, else { for (int f = 0; f < 9; f ++) - mBorder.grid[f] = 0; + mBorder.grid[f] = nullptr; } } @@ -108,7 +108,7 @@ ProgressBar::~ProgressBar() if (mInstances == 0) for_each(mBorder.grid, mBorder.grid + 9, dtor<Image*>()); delete mVertexes; - mVertexes = 0; + mVertexes = nullptr; } void ProgressBar::logic() diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index feedeae7b..7d344b09d 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -112,7 +112,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics) radioCheckedHi->setAlpha(mAlpha); } - Image *box = NULL; + Image *box = nullptr; if (isEnabled()) { diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 861dde29e..c8822eea9 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -34,7 +34,7 @@ #include "debug.h" -Image *ResizeGrip::gripImage = 0; +Image *ResizeGrip::gripImage = nullptr; int ResizeGrip::mInstances = 0; float ResizeGrip::mAlpha = 1.0; @@ -69,7 +69,7 @@ ResizeGrip::~ResizeGrip() if (mInstances == 0 && gripImage) { gripImage->decRef(); - gripImage = 0; + gripImage = nullptr; } } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 3204028dc..0ec4a2027 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -111,7 +111,7 @@ ScrollArea::~ScrollArea() buttons[RIGHT][1]->decRef(); } delete mVertexes; - mVertexes = 0; + mVertexes = nullptr; } void ScrollArea::init() @@ -147,7 +147,7 @@ void ScrollArea::init() } else { - background.grid[a] = 0; + background.grid[a] = nullptr; } a++; } @@ -179,7 +179,7 @@ void ScrollArea::init() } else { - vMarker.grid[a] = 0; + vMarker.grid[a] = nullptr; } if (vscrollHi) { @@ -192,7 +192,7 @@ void ScrollArea::init() } else { - vMarkerHi.grid[a] = 0; + vMarkerHi.grid[a] = nullptr; } a++; } diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 698e133dd..8081f5d7b 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -53,7 +53,7 @@ SetupItem::SetupItem(std::string text, std::string description, mUseDefault(false), mValue(""), mDefault(""), - mWidget(0), + mWidget(nullptr), mValueType(VBOOL) { } @@ -70,7 +70,7 @@ SetupItem::SetupItem(std::string text, std::string description, mUseDefault(true), mValue(""), mDefault(def), - mWidget(0), + mWidget(nullptr), mValueType(VBOOL) { } @@ -184,7 +184,7 @@ SetupItemCheckBox::SetupItemCheckBox(std::string text, std::string description, SetupItemCheckBox::~SetupItemCheckBox() { - mWidget = 0; + mWidget = nullptr; } void SetupItemCheckBox::createControls() @@ -225,11 +225,11 @@ SetupItemTextField::SetupItemTextField(std::string text, std::string eventName, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, mainConfig), - mHorizont(0), - mLabel(0), - mTextField(0), - mButton(0), - mEditDialog(0) + mHorizont(nullptr), + mLabel(nullptr), + mTextField(nullptr), + mButton(nullptr), + mEditDialog(nullptr) { mValueType = VSTR; createControls(); @@ -242,11 +242,11 @@ SetupItemTextField::SetupItemTextField(std::string text, std::string eventName, std::string def, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, def, mainConfig), - mHorizont(0), - mLabel(0), - mTextField(0), - mButton(0), - mEditDialog(0) + mHorizont(nullptr), + mLabel(nullptr), + mTextField(nullptr), + mButton(nullptr), + mEditDialog(nullptr) { mValueType = VSTR; createControls(); @@ -254,11 +254,11 @@ SetupItemTextField::SetupItemTextField(std::string text, SetupItemTextField::~SetupItemTextField() { - mHorizont = 0; - mWidget = 0; - mTextField = 0; - mLabel = 0; - mButton = 0; + mHorizont = nullptr; + mWidget = nullptr; + mTextField = nullptr; + mLabel = nullptr; + mButton = nullptr; } void SetupItemTextField::createControls() @@ -318,7 +318,7 @@ void SetupItemTextField::action(const gcn::ActionEvent &event) else if (event.getId() == mEventName + "_EDIT_OK") { mTextField->setText(mEditDialog->getMsg()); - mEditDialog = 0; + mEditDialog = nullptr; } } @@ -339,13 +339,13 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text, int min, int max, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, mainConfig), - mHorizont(0), - mLabel(0), - mTextField(0), - mButton(0), + mHorizont(nullptr), + mLabel(nullptr), + mTextField(nullptr), + mButton(nullptr), mMin(min), mMax(max), - mEditDialog(0) + mEditDialog(nullptr) { mValueType = VSTR; createControls(); @@ -360,13 +360,13 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text, std::string def, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, def, mainConfig), - mHorizont(0), - mLabel(0), - mTextField(0), - mButton(0), + mHorizont(nullptr), + mLabel(nullptr), + mTextField(nullptr), + mButton(nullptr), mMin(min), mMax(max), - mEditDialog(0) + mEditDialog(nullptr) { mValueType = VSTR; createControls(); @@ -374,11 +374,11 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text, SetupItemIntTextField::~SetupItemIntTextField() { - mHorizont = 0; - mWidget = 0; - mTextField = 0; - mLabel = 0; - mButton = 0; + mHorizont = nullptr; + mWidget = nullptr; + mTextField = nullptr; + mLabel = nullptr; + mButton = nullptr; } void SetupItemIntTextField::createControls() @@ -441,7 +441,7 @@ void SetupItemIntTextField::action(const gcn::ActionEvent &event) else if (event.getId() == mEventName + "_EDIT_OK") { mTextField->setValue(atoi(mEditDialog->getMsg().c_str())); - mEditDialog = 0; + mEditDialog = nullptr; } } @@ -459,7 +459,7 @@ void SetupItemIntTextField::apply(std::string eventName) SetupItemLabel::SetupItemLabel(std::string text, std::string description, SetupTabScroll *parent, bool separator) : SetupItem(text, description, "", parent, "", "", true), - mLabel(0), + mLabel(nullptr), mIsSeparator(separator) { mValueType = VNONE; @@ -468,8 +468,8 @@ SetupItemLabel::SetupItemLabel(std::string text, std::string description, SetupItemLabel::~SetupItemLabel() { - mWidget = 0; - mLabel = 0; + mWidget = nullptr; + mLabel = nullptr; } void SetupItemLabel::createControls() @@ -517,10 +517,10 @@ SetupItemDropDown::SetupItemDropDown(std::string text, gcn::ListModel *model, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, mainConfig), - mHorizont(0), - mLabel(0), + mHorizont(nullptr), + mLabel(nullptr), mModel(model), - mDropDown(0) + mDropDown(nullptr) { mValueType = VSTR; createControls(); @@ -535,10 +535,10 @@ SetupItemDropDown::SetupItemDropDown(std::string text, std::string def, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, def, mainConfig), - mHorizont(0), - mLabel(0), + mHorizont(nullptr), + mLabel(nullptr), mModel(model), - mDropDown(0) + mDropDown(nullptr) { mValueType = VSTR; createControls(); @@ -546,11 +546,11 @@ SetupItemDropDown::SetupItemDropDown(std::string text, SetupItemDropDown::~SetupItemDropDown() { - mHorizont = 0; - mWidget = 0; - mModel = 0; - mDropDown = 0; - mLabel = 0; + mHorizont = nullptr; + mWidget = nullptr; + mModel = nullptr; + mDropDown = nullptr; + mLabel = nullptr; } void SetupItemDropDown::createControls() diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp index e9917b090..4fb092070 100644 --- a/src/gui/widgets/setuptabscroll.cpp +++ b/src/gui/widgets/setuptabscroll.cpp @@ -43,10 +43,10 @@ SetupTabScroll::SetupTabScroll() : SetupTabScroll::~SetupTabScroll() { - mScroll = 0; + mScroll = nullptr; delete mContainer; - mContainer = 0; + mContainer = nullptr; std::set<SetupItem*>::iterator it = mAllItems.begin(); std::set<SetupItem*>::iterator it_end = mAllItems.end(); diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp index e15445b77..d3aac5c56 100644 --- a/src/gui/widgets/shopitems.cpp +++ b/src/gui/widgets/shopitems.cpp @@ -75,7 +75,7 @@ void ShopItems::addItemNoDup(int id, unsigned char color, void ShopItems::addItem2(int inventoryIndex, int id, unsigned char color, int quantity, int price) { - ShopItem *item = 0; + ShopItem *item = nullptr; if (mMergeDuplicates) item = findItem(id, color); @@ -93,7 +93,7 @@ void ShopItems::addItem2(int inventoryIndex, int id, unsigned char color, ShopItem *ShopItems::at(unsigned int i) const { if (i >= mShopItems.size()) - return 0; + return nullptr; return mShopItems.at(i); } @@ -137,5 +137,5 @@ ShopItem *ShopItems::findItem(int id, unsigned char color) const ++it; } - return 0; + return nullptr; } diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 793491808..b649a81ef 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -47,7 +47,7 @@ float ShopListBox::mAlpha = 1.0; ShopListBox::ShopListBox(gcn::ListModel *listModel): ListBox(listModel), mPlayerMoney(0), - mShopItems(0) + mShopItems(nullptr) { mRowHeight = getFont()->getHeight(); init(); diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 9fd9b26c6..36f88da08 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -33,7 +33,7 @@ float ShortcutContainer::mAlpha = 1.0; ShortcutContainer::ShortcutContainer(): - mBackgroundImg(0), + mBackgroundImg(nullptr), mMaxItems(0), mBoxWidth(1), mBoxHeight(1), diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index d29c2211f..3822d40c9 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -101,9 +101,9 @@ void Slider::init() } else { - hStart = 0; - hMid = 0; - hEnd = 0; + hStart = nullptr; + hMid = nullptr; + hEnd = nullptr; } if (sliderHi) { @@ -113,9 +113,9 @@ void Slider::init() } else { - hStartHi = 0; - hMidHi = 0; - hEndHi = 0; + hStartHi = nullptr; + hMidHi = nullptr; + hEndHi = nullptr; } x = 6; y = 8; @@ -123,11 +123,11 @@ void Slider::init() if (slider) hGrip = slider->getSubImage(x, y, w, h); else - hGrip = 0; + hGrip = nullptr; if (sliderHi) hGripHi = sliderHi->getSubImage(x, y, w, h); else - hGripHi = 0; + hGripHi = nullptr; x = 0; y = 6; w = 6; h = 21; @@ -140,9 +140,9 @@ void Slider::init() } else { - vStart = 0; - vMid = 0; - vEnd = 0; + vStart = nullptr; + vMid = nullptr; + vEnd = nullptr; } if (sliderHi) { @@ -152,9 +152,9 @@ void Slider::init() } else { - vStartHi = 0; - vMidHi = 0; - vEndHi = 0; + vStartHi = nullptr; + vMidHi = nullptr; + vEndHi = nullptr; } x = 6; y = 8; @@ -162,12 +162,12 @@ void Slider::init() if (slider) vGrip = slider->getSubImage(x, y, w, h); else - vGrip = 0; + vGrip = nullptr; if (sliderHi) vGripHi = sliderHi->getSubImage(x, y, w, h); else - vGripHi = 0; + vGripHi = nullptr; if (slider) slider->decRef(); diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 6317dd56f..5c4dbc9a1 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -54,7 +54,7 @@ SpellShortcutContainer::SpellShortcutContainer(unsigned number): ShortcutContainer(), mSpellClicked(false), - mSpellMoved(NULL), + mSpellMoved(nullptr), mNumber(number) { mBoxWidth = mBoxWidth; @@ -88,9 +88,9 @@ SpellShortcutContainer::~SpellShortcutContainer() { if (mBackgroundImg) mBackgroundImg->decRef(); - mBackgroundImg = 0; + mBackgroundImg = nullptr; delete mSpellPopup; - mSpellPopup = 0; + mSpellPopup = nullptr; } void SpellShortcutContainer::draw(gcn::Graphics *graphics) @@ -251,7 +251,7 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) } else if (event.getButton() == gcn::MouseEvent::RIGHT) { - TextCommand *spell = NULL; + TextCommand *spell = nullptr; if (itemId >= 0) spell = spellManager->getSpell(itemId); diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 530f1ac82..8e4b1fe6f 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -91,7 +91,7 @@ Tab::~Tab() for_each(tabImg[mode].grid, tabImg[mode].grid + 9, dtor<Image*>()); } delete mVertexes; - mVertexes = 0; + mVertexes = nullptr; } void Tab::init() diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 47b02c925..fb9279343 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -46,15 +46,15 @@ TabbedArea::TabbedArea() mArrowButton[0] = new Button("<", "shift_left", this); mArrowButton[1] = new Button(">", "shift_right", this); - widgetResized(NULL); + widgetResized(nullptr); } TabbedArea::~TabbedArea() { delete mArrowButton[0]; - mArrowButton[0] = 0; + mArrowButton[0] = nullptr; delete mArrowButton[1]; - mArrowButton[1] = 0; + mArrowButton[1] = nullptr; } void TabbedArea::enableScrollButtons(bool enable) @@ -90,7 +90,7 @@ Tab *TabbedArea::getTab(const std::string &name) const ++itr; } - return NULL; + return nullptr; } void TabbedArea::draw(gcn::Graphics *graphics) @@ -112,7 +112,7 @@ gcn::Widget *TabbedArea::getWidget(const std::string &name) const ++itr; } - return NULL; + return nullptr; } gcn::Widget *TabbedArea::getCurrentWidget() @@ -122,7 +122,7 @@ gcn::Widget *TabbedArea::getCurrentWidget() if (tab) return getWidget(tab->getCaption()); else - return NULL; + return nullptr; } void TabbedArea::addTab(gcn::Tab* tab, gcn::Widget* widget) @@ -192,7 +192,7 @@ void TabbedArea::removeTab(gcn::Tab *tab) if (tabIndexToBeSelected == -1) { - mSelectedTab = 0; + mSelectedTab = nullptr; mWidgetContainer->clear(); } else @@ -238,7 +238,7 @@ void TabbedArea::setSelectedTab(gcn::Tab *tab) if (newTab) newTab->setCurrent(); - widgetResized(NULL); + widgetResized(nullptr); } void TabbedArea::setSelectedTab(const std::string &name) @@ -266,7 +266,7 @@ void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED) if (w) { int newScroll = 0; - ScrollArea* scr = 0; + ScrollArea* scr = nullptr; if (mFollowDownScroll && height != 0) { gcn::Rectangle rect = w->getDimension(); @@ -444,14 +444,14 @@ void TabbedArea::updateArrowEnableState() Tab *TabbedArea::getTabByIndex(int index) const { if (index < 0 || index >= static_cast<int>(mTabs.size())) - return 0; + return nullptr; return static_cast<Tab*>(mTabs[index].first); } gcn::Widget *TabbedArea::getWidgetByIndex(int index) const { if (index < 0 || index >= static_cast<int>(mTabs.size())) - return 0; + return nullptr; return mTabs[index].second; } diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index 6c932a411..f54b4281a 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -68,7 +68,7 @@ StaticTableModel::StaticTableModel(int row, int column) : mColumns(column), mHeight(1) { - mTableModel.resize(row * column, NULL); + mTableModel.resize(row * column, nullptr); mWidths.resize(column, 1); } @@ -82,7 +82,7 @@ void StaticTableModel::resize() { mRows = getRows(); mColumns = getColumns(); - mTableModel.resize(mRows * mColumns, NULL); + mTableModel.resize(mRows * mColumns, nullptr); } void StaticTableModel::set(int row, int column, gcn::Widget *widget) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 6ce4cbf3b..b4584947a 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -86,7 +86,7 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab, } else { - skin.grid[a] = 0; + skin.grid[a] = nullptr; } a++; } diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 93f970168..e530cfef2 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -25,6 +25,8 @@ #include <guichan/widgets/textfield.hpp> +#include "localconsts.h" + class ImageRect; class TextField; @@ -40,7 +42,7 @@ class TextField : public gcn::TextField * Constructor, initializes the text field with the given string. */ TextField(const std::string &text = "", bool loseFocusOnTab = true, - gcn::ActionListener* listener = NULL, + gcn::ActionListener* listener = nullptr, std::string eventId = "", bool sendAlwaysEvents = false); ~TextField(); diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 07cf19b61..9be2d5b3f 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -44,7 +44,7 @@ TextPreview::TextPreview(const std::string &text): mTextAlpha = false; mFont = gui->getFont(); mTextColor = &Theme::getThemeColor(Theme::TEXT); - mTextBGColor = NULL; + mTextBGColor = nullptr; mBGColor = &Theme::getThemeColor(Theme::BACKGROUND); mOpaque = false; } diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index c52bf744e..273695a1a 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -49,9 +49,9 @@ int Window::mouseResize = 0; Window::Window(const std::string &caption, bool modal, Window *parent, std::string skin): gcn::Window(caption), - mGrip(0), + mGrip(nullptr), mParent(parent), - mLayout(NULL), + mLayout(nullptr), mWindowName("window"), mShowTitle(true), mModal(modal), @@ -91,7 +91,7 @@ Window::Window(const std::string &caption, bool modal, Window *parent, } else { - mSkin = 0; + mSkin = nullptr; } // Add this window to the window container @@ -118,7 +118,7 @@ Window::~Window() saveWindowState(); delete mLayout; - mLayout = 0; + mLayout = nullptr; while (!mWidgets.empty()) delete mWidgets.front(); @@ -127,7 +127,7 @@ Window::~Window() removeWidgetListener(this); delete mVertexes; - mVertexes = 0; + mVertexes = nullptr; instances--; @@ -135,7 +135,7 @@ Window::~Window() { if (Theme::instance()) Theme::instance()->unload(mSkin); - mSkin = 0; + mSkin = nullptr; } } @@ -348,7 +348,7 @@ void Window::setResizable(bool r) { remove(mGrip); delete mGrip; - mGrip = 0; + mGrip = nullptr; } } @@ -947,7 +947,7 @@ void Window::reflowLayout(int w, int h) mLayout->reflow(w, h); delete mLayout; - mLayout = 0; + mLayout = nullptr; setContentSize(w, h); } diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index ffc27ab10..5ace2328e 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -25,6 +25,7 @@ #include "graphics.h" #include "guichanfwd.h" +#include "localconsts.h" #include <guichan/widgetlistener.hpp> @@ -65,7 +66,7 @@ class Window : public gcn::Window, gcn::WidgetListener * @param skin The location where the window's skin XML can be found. */ Window(const std::string &caption = "Window", bool modal = false, - Window *parent = NULL, std::string skin = ""); + Window *parent = nullptr, std::string skin = ""); /** * Destructor. Deletes all the added widgets. diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index 5a3c16037..34a6b68c7 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -26,7 +26,7 @@ #include "debug.h" -WindowContainer *windowContainer = NULL; +WindowContainer *windowContainer = nullptr; void WindowContainer::logic() { diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index b4f697ba3..3749049fe 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -140,7 +140,7 @@ void WorldSelectDialog::keyPressed(gcn::KeyEvent &keyEvent) gcn::Key key = keyEvent.getKey(); if (key.getValue() == Key::ESCAPE) - action(gcn::ActionEvent(NULL, mChangeLoginButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, mChangeLoginButton->getActionEventId())); else if (key.getValue() == Key::ENTER) - action(gcn::ActionEvent(NULL, mChooseWorld->getActionEventId())); + action(gcn::ActionEvent(nullptr, mChooseWorld->getActionEventId())); } |