From 9e83411f7e4147d09af5a5006888dcc187ea0ef8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 7 Nov 2011 19:34:52 +0300 Subject: Fix some warnings under gcc 4.7. --- src/gui/widgets/avatarlistbox.cpp | 8 +-- src/gui/widgets/browserbox.cpp | 7 ++- src/gui/widgets/browserbox.h | 4 +- src/gui/widgets/button.cpp | 2 +- src/gui/widgets/chattab.cpp | 4 +- src/gui/widgets/checkbox.cpp | 24 ++++---- src/gui/widgets/checkbox.h | 4 +- src/gui/widgets/desktop.cpp | 4 +- src/gui/widgets/dropdown.cpp | 2 +- src/gui/widgets/dropdown.h | 4 +- src/gui/widgets/dropshortcutcontainer.cpp | 10 +-- src/gui/widgets/emoteshortcutcontainer.cpp | 2 +- src/gui/widgets/flowcontainer.cpp | 2 +- src/gui/widgets/guitable.cpp | 16 ++--- src/gui/widgets/guitable.h | 4 +- src/gui/widgets/icon.cpp | 2 +- src/gui/widgets/itemcontainer.cpp | 8 +-- src/gui/widgets/itemlinkhandler.cpp | 2 +- src/gui/widgets/itemshortcutcontainer.cpp | 12 ++-- src/gui/widgets/layout.cpp | 4 +- src/gui/widgets/layout.h | 6 +- src/gui/widgets/playerbox.cpp | 4 +- src/gui/widgets/playerbox.h | 3 +- src/gui/widgets/popup.cpp | 6 +- src/gui/widgets/progressbar.cpp | 4 +- src/gui/widgets/radiobutton.cpp | 2 +- src/gui/widgets/resizegrip.cpp | 4 +- src/gui/widgets/scrollarea.cpp | 8 +-- src/gui/widgets/setupitem.cpp | 98 +++++++++++++++--------------- src/gui/widgets/setuptabscroll.cpp | 4 +- src/gui/widgets/shopitems.cpp | 6 +- src/gui/widgets/shoplistbox.cpp | 2 +- src/gui/widgets/shortcutcontainer.cpp | 2 +- src/gui/widgets/slider.cpp | 32 +++++----- src/gui/widgets/spellshortcutcontainer.cpp | 8 +-- src/gui/widgets/tab.cpp | 2 +- src/gui/widgets/tabbedarea.cpp | 22 +++---- src/gui/widgets/tablemodel.cpp | 4 +- src/gui/widgets/textfield.cpp | 2 +- src/gui/widgets/textfield.h | 4 +- src/gui/widgets/textpreview.cpp | 2 +- src/gui/widgets/window.cpp | 16 ++--- src/gui/widgets/window.h | 3 +- src/gui/widgets/windowcontainer.cpp | 2 +- 44 files changed, 193 insertions(+), 178 deletions(-) (limited to 'src/gui/widgets') 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 #include +#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 +#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 +#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 @@ -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 #include @@ -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()); 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 NULL 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()); 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::iterator it = mAllItems.begin(); std::set::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()); } 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(mTabs.size())) - return 0; + return nullptr; return static_cast(mTabs[index].first); } gcn::Widget *TabbedArea::getWidgetByIndex(int index) const { if (index < 0 || index >= static_cast(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 +#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 @@ -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() { -- cgit v1.2.3-70-g09d2