diff options
Diffstat (limited to 'src')
38 files changed, 170 insertions, 157 deletions
diff --git a/src/gui/dialogsmanager.h b/src/gui/dialogsmanager.h index cc42c08d5..61a150dae 100644 --- a/src/gui/dialogsmanager.h +++ b/src/gui/dialogsmanager.h @@ -40,6 +40,9 @@ class DialogsManager final : public AttributeListener, public: DialogsManager(); + virtual ~DialogsManager() + { } + static void closeDialogs(); static void createUpdaterWindow(); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index a7e14983e..e2d6ca054 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -569,7 +569,7 @@ void Gui::setUseCustomCursor(const bool customCursor) void Gui::handleMouseMoved(const MouseInput &mouseInput) { // Check if the mouse leaves the application window. - if (!mWidgetWithMouseQueue.empty() && (mouseInput.getX() < 0 + if (mTop && !mWidgetWithMouseQueue.empty() && (mouseInput.getX() < 0 || mouseInput.getY() < 0 || !mTop->getDimension().isPointInRect( mouseInput.getX(), mouseInput.getY()))) { diff --git a/src/gui/gui.h b/src/gui/gui.h index ea9dae7ef..420e79734 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -278,7 +278,7 @@ class Gui final * SDLInput * @since 0.1.0 */ - void setInput(SDLInput *const input); + void setInput(SDLInput *const input) A_NONNULL(2); /** * Gets the input object being used for input handling. @@ -438,17 +438,17 @@ class Gui final /** * Holds the graphics implementation used. */ - Graphics* mGraphics; + Graphics* mGraphics A_NONNULLPOINTER; /** * Holds the input implementation used. */ - SDLInput* mInput; + SDLInput* mInput A_NONNULLPOINTER; /** * Holds the focus handler for the Gui. */ - FocusHandler* mFocusHandler; + FocusHandler* mFocusHandler A_NONNULLPOINTER; /** * Typedef. @@ -505,12 +505,18 @@ class Gui final std::deque<Widget*> mWidgetWithMouseQueue; GuiConfigListener *mConfigListener; - Font *mGuiFont; /**< The global GUI font */ - Font *mInfoParticleFont; /**< Font for Info Particles */ - Font *mHelpFont; /**< Font for Help Window */ - Font *mSecureFont; /**< Font for secure labels */ - Font *mNpcFont; /**< Font for npc text */ - ImageSet *mMouseCursors; /**< Mouse cursor images */ + /** The global GUI font */ + Font *mGuiFont A_NONNULLPOINTER; + /** Font for Info Particles */ + Font *mInfoParticleFont A_NONNULLPOINTER; + /** Font for Help Window */ + Font *mHelpFont A_NONNULLPOINTER; + /** Font for secure labels */ + Font *mSecureFont A_NONNULLPOINTER; + /** Font for npc text */ + Font *mNpcFont A_NONNULLPOINTER; + /** Mouse cursor images */ + ImageSet *mMouseCursors; float mMouseCursorAlpha; int mMouseInactivityTimer; Cursor::Cursor mCursorType; @@ -534,6 +540,6 @@ extern SDLInput *guiInput; /**< GUI input */ /** * Bolded text font */ -extern Font *boldFont; +extern Font *boldFont A_NONNULLPOINTER; #endif // GUI_GUI_H diff --git a/src/gui/models/colormodel.cpp b/src/gui/models/colormodel.cpp index a31b245c4..b1c07d52c 100644 --- a/src/gui/models/colormodel.cpp +++ b/src/gui/models/colormodel.cpp @@ -69,7 +69,7 @@ void ColorModel::add(const std::string &name, const Color *const color1, ColorModel *ColorModel::createDefault(const Widget2 *const widget) { - ColorModel *const model = new ColorModel(); + ColorModel *const model = new ColorModel; if (!widget) return model; // TRANSLATORS: color name diff --git a/src/gui/models/langlistmodel.h b/src/gui/models/langlistmodel.h index 476ff41c9..62bc15e3e 100644 --- a/src/gui/models/langlistmodel.h +++ b/src/gui/models/langlistmodel.h @@ -122,7 +122,7 @@ class LangListModel final : public ExtendedListModel return mIcons[i]; } - Image *mIcons[langs_count]; + Image *mIcons[langs_count] A_NONNULLPOINTER; }; #endif // GUI_MODELS_LANGLISTMODEL_H diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index 757a61a23..8cca7aa2c 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -90,7 +90,7 @@ void Palette::advanceGradient() for (size_t i = 0, sz = mGradVector.size(); i < sz; i++) { - ColorElem *const elem = mGradVector[i]; + ColorElem *const elem A_NONNULLPOINTER = mGradVector[i]; if (!elem) continue; diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index d83fd7bd5..727818317 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -201,8 +201,8 @@ class PopupMenu final : public Popup, public LinkHandler bool addBeingMenu(); - BrowserBox *mBrowserBox; - ScrollArea *mScrollArea; + BrowserBox *mBrowserBox A_NONNULLPOINTER; + ScrollArea *mScrollArea A_NONNULLPOINTER; BeingId mBeingId; BeingId mFloorItemId; diff --git a/src/gui/popups/textboxpopup.h b/src/gui/popups/textboxpopup.h index 3bfc92f6a..44d4ad247 100644 --- a/src/gui/popups/textboxpopup.h +++ b/src/gui/popups/textboxpopup.h @@ -56,7 +56,7 @@ class TextBoxPopup final : public Popup void mouseMoved(MouseEvent &event) override final; private: - TextBox *mTextBox; + TextBox *mTextBox A_NONNULLPOINTER; }; extern TextBoxPopup *textBoxPopup; diff --git a/src/gui/skin.h b/src/gui/skin.h index c3e4e01b2..97d8ba038 100644 --- a/src/gui/skin.h +++ b/src/gui/skin.h @@ -38,10 +38,10 @@ class Skin final Skin(ImageRect *const restrict skin, const ImageRect *const restrict images, const std::string &filePath, - const std::string &name = "", - const int padding = 3, - const int titlePadding = 4, - StringIntMap *restrict const options = nullptr); + const std::string &name, + const int padding, + const int titlePadding, + StringIntMap *restrict const options) A_NONNULL(8); A_DELETE_COPY(Skin) @@ -129,7 +129,7 @@ class Skin final Image *mStickyImageDown; /**< Sticky Button Image */ int mPadding; int mTitlePadding; - StringIntMap *mOptions; + StringIntMap *mOptions A_NONNULLPOINTER; }; #endif // GUI_SKIN_H diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index e70165648..c0c0e4803 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -195,11 +195,8 @@ void Viewport::draw(Graphics *graphics) { logger->log("incorrect player position: %d, %d, %d, %d", player_x, player_y, mPixelViewX, mPixelViewY); - if (localPlayer) - { - logger->log("tile position: %d, %d", - localPlayer->getTileX(), localPlayer->getTileY()); - } + logger->log("tile position: %d, %d", + localPlayer->getTileX(), localPlayer->getTileY()); } mPixelViewX = player_x; mPixelViewY = player_y; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 67dbbe632..d5eb6b89a 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -963,8 +963,9 @@ void BrowserBox::moveSelectionDown() void BrowserBox::selectSelection() { - if (mSelectedLink < 0 || mSelectedLink >= static_cast<signed int>( - mLinks.size())) + if (!mLinkHandler || + mSelectedLink < 0 || + mSelectedLink >= static_cast<signed int>(mLinks.size())) { return; } diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index a4222c395..cb96fa7e3 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -286,7 +286,7 @@ class Button final : public Widget, TextChunk mTextChunk; - ImageCollection *mVertexes2; + ImageCollection *mVertexes2 A_NONNULLPOINTER; Color mEnabledColor; Color mEnabledColor2; Color mDisabledColor; diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index 686466e12..65add714f 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -86,8 +86,8 @@ class CharacterDisplay final : public Container, private: Net::Character *mCharacter; - PlayerBox *mPlayerBox; - Label *mName; + PlayerBox *mPlayerBox A_NONNULLPOINTER; + Label *mName A_NONNULLPOINTER; }; #endif // GUI_WIDGETS_CHARACTERDISPLAY_H diff --git a/src/gui/widgets/containerplacer.cpp b/src/gui/widgets/containerplacer.cpp index d393ab8ea..eefd82073 100644 --- a/src/gui/widgets/containerplacer.cpp +++ b/src/gui/widgets/containerplacer.cpp @@ -29,12 +29,15 @@ ContainerPlacer ContainerPlacer::at(const int x, const int y) { - return ContainerPlacer(mContainer, &mCell->at(x, y)); + return ContainerPlacer(mContainer, mCell ? &mCell->at(x, y) : nullptr); } LayoutCell &ContainerPlacer::operator() (const int x, const int y, Widget *const wg, const int w, const int h) { - mContainer->add(wg); - return mCell->place(wg, x, y, w, h); + if (mContainer) + mContainer->add(wg); + if (mCell) + return mCell->place(wg, x, y, w, h); + return LayoutCell::emptyCell; } diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 13128ad9f..6186f1bc8 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -117,8 +117,7 @@ DropDown::DropDown(const Widget2 *const widget, } // get the border skin - if (theme) - theme->loadRect(skinRect, "dropdown_background.xml", ""); + theme->loadRect(skinRect, "dropdown_background.xml", ""); } instances++; diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index e07e783c7..fb4d03e94 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -145,7 +145,7 @@ class DropDown final : public ActionListener, */ void drawButton(Graphics *graphics) A_NONNULL(2); - PopupList *mPopup; + PopupList *mPopup A_NONNULLPOINTER; Color mShadowColor; Color mHighlightColor; int mPadding; diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index ff9342661..1743f06c6 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -180,7 +180,7 @@ class GuiTable final : public Widget, static float mAlpha; - TableModel *mModel; + TableModel *mModel A_NONNULLPOINTER; /** If someone moves a fresh widget to the top, we must display it. */ Widget *mTopWidget; diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 9cfa0345d..e728cb3a4 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -71,7 +71,7 @@ namespace bool operator() (const ItemIdPair *const pair1, const ItemIdPair *const pair2) const { - if (!pair1 || !pair2) + if (!pair1->mItem || !pair2->mItem) return false; return (pair1->mItem->getInfo().getName() @@ -85,7 +85,7 @@ namespace bool operator() (const ItemIdPair *const pair1, const ItemIdPair *const pair2) const { - if (!pair1 || !pair2) + if (!pair1->mItem || !pair2->mItem) return false; return pair1->mItem->getId() < pair2->mItem->getId(); @@ -98,7 +98,7 @@ namespace bool operator() (const ItemIdPair *const pair1, const ItemIdPair *const pair2) const { - if (!pair1 || !pair2) + if (!pair1->mItem || !pair2->mItem) return false; const int w1 = pair1->mItem->getInfo().getWeight(); @@ -118,7 +118,7 @@ namespace bool operator() (const ItemIdPair *const pair1, const ItemIdPair *const pair2) const { - if (!pair1 || !pair2) + if (!pair1->mItem || !pair2->mItem) return false; const int c1 = pair1->mItem->getQuantity(); @@ -138,7 +138,7 @@ namespace bool operator() (const ItemIdPair *const pair1, const ItemIdPair *const pair2) const { - if (!pair1 || !pair2) + if (!pair1->mItem || !pair2->mItem) return false; const ItemInfo &info1 = pair1->mItem->getInfo(); @@ -490,7 +490,7 @@ void ItemContainer::mouseDragged(MouseEvent &event A_UNUSED) void ItemContainer::mouseReleased(MouseEvent &event) { - if (mClicks == 2) + if (mClicks == 2 || !inventoryHandler || !tradeHandler) return; switch (mSelectionStatus) diff --git a/src/gui/widgets/layoutcell.cpp b/src/gui/widgets/layoutcell.cpp index c6668eb8d..941e2d008 100644 --- a/src/gui/widgets/layoutcell.cpp +++ b/src/gui/widgets/layoutcell.cpp @@ -30,6 +30,7 @@ #include "debug.h" static LayoutArray tempArray; +LayoutCell LayoutCell::emptyCell; LayoutCell::~LayoutCell() { diff --git a/src/gui/widgets/layoutcell.h b/src/gui/widgets/layoutcell.h index 18758c0ee..ea696ca2b 100644 --- a/src/gui/widgets/layoutcell.h +++ b/src/gui/widgets/layoutcell.h @@ -142,6 +142,8 @@ class LayoutCell notfinal ARRAY }; + static LayoutCell emptyCell; + private: LayoutCell() : mWidget(nullptr), diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index 70faff0f8..2322f92c2 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -74,8 +74,8 @@ class PopupList final : public Popup, private: ListModel *mListModel; - ListBox *mListBox; - ScrollArea *mScrollArea; + ListBox *mListBox A_NONNULLPOINTER; + ScrollArea *mScrollArea A_NONNULLPOINTER; DropDown *mDropDown; int mPressedIndex; Modal mModal; diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 1d341e46b..a03ab9ad5 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -479,8 +479,8 @@ class ScrollArea final : public BasicContainer, static ImageRect hBackground; static Image *buttons[4][2]; - ImageCollection *mVertexes; - ImageCollection *mVertexes2; + ImageCollection *mVertexes A_NONNULLPOINTER; + ImageCollection *mVertexes2 A_NONNULLPOINTER; /** * Holds the horizontal scroll bar policy. diff --git a/src/gui/widgets/selldialog.h b/src/gui/widgets/selldialog.h index a9cb24870..dcc92cfd2 100644 --- a/src/gui/widgets/selldialog.h +++ b/src/gui/widgets/selldialog.h @@ -123,17 +123,17 @@ class SellDialog notfinal : public Window, virtual void initButtons() { } - Button *mSellButton; - Button *mQuitButton; + Button *mSellButton A_NONNULLPOINTER; + Button *mQuitButton A_NONNULLPOINTER; Button *mAddMaxButton; Button *mIncreaseButton; Button *mDecreaseButton; - ShopListBox *mShopItemList; - ScrollArea *mScrollArea; + ShopListBox *mShopItemList A_NONNULLPOINTER; + ScrollArea *mScrollArea A_NONNULLPOINTER; Label *mMoneyLabel; Label *mQuantityLabel; Slider *mSlider; - ShopItems *mShopItems; + ShopItems *mShopItems A_NONNULLPOINTER; int mPlayerMoney; int mMaxItems; diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 525fd3c92..b13389777 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -77,8 +77,8 @@ class SliderList final : public Container, int getMaxLabelWidth() const A_WARN_UNUSED; - Button *mButtons[2]; - Label *mLabel; + Button *mButtons[2] A_NONNULLPOINTER; + Label *mLabel A_NONNULLPOINTER; ListModel *mListModel; std::string mPrevEventId; std::string mNextEventId; diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 40ac05753..69d64547b 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -241,7 +241,7 @@ class TabbedArea final : public ActionListener, typedef std::vector <std::pair<Tab*, Widget*> > TabContainer; /** The tab arrows */ - Button *mArrowButton[2]; + Button *mArrowButton[2] A_NONNULLPOINTER; /** Check whether the arrow should be clickable */ void updateArrowEnableState(); @@ -253,8 +253,8 @@ class TabbedArea final : public ActionListener, void updateTabsWidth(); Tab* mSelectedTab; - BasicContainer2* mTabContainer; - BasicContainer2* mWidgetContainer; + BasicContainer2* mTabContainer A_NONNULLPOINTER; + BasicContainer2* mWidgetContainer A_NONNULLPOINTER; std::vector<Tab*> mTabsToDelete; TabContainer mTabs; diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h index 56d51b097..a03b51a86 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -201,7 +201,7 @@ class ChatTab notfinal : public Tab void addRow(std::string &line); - BrowserBox *mTextOutput; + BrowserBox *mTextOutput A_NONNULLPOINTER; ScrollArea *mScrollArea; std::string mChannelName; std::string mLogName; diff --git a/src/gui/widgets/tabs/debugwindowtabs.h b/src/gui/widgets/tabs/debugwindowtabs.h index da464dfaa..05eea784b 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.h +++ b/src/gui/widgets/tabs/debugwindowtabs.h @@ -59,23 +59,23 @@ class MapDebugTab final : public DebugTab void logic() override final; private: - Label *mMusicFileLabel; - Label *mMapLabel; - Label *mMinimapLabel; - Label *mTileMouseLabel; - Label *mParticleCountLabel; - Label *mMapActorCountLabel; - Label *mXYLabel; - Label *mTexturesLabel; + Label *mMusicFileLabel A_NONNULLPOINTER; + Label *mMapLabel A_NONNULLPOINTER; + Label *mMinimapLabel A_NONNULLPOINTER; + Label *mTileMouseLabel A_NONNULLPOINTER; + Label *mParticleCountLabel A_NONNULLPOINTER; + Label *mMapActorCountLabel A_NONNULLPOINTER; + Label *mXYLabel A_NONNULLPOINTER; + Label *mTexturesLabel A_NONNULLPOINTER; int mUpdateTime; #ifdef DEBUG_DRAW_CALLS - Label *mDrawCallsLabel; + Label *mDrawCallsLabel A_NONNULLPOINTER; #endif #ifdef DEBUG_BIND_TEXTURE - Label *mBindsLabel; + Label *mBindsLabel A_NONNULLPOINTER; #endif - Label *mFPSLabel; - Label *mLPSLabel; + Label *mFPSLabel A_NONNULLPOINTER; + Label *mLPSLabel A_NONNULLPOINTER; std::string mFPSText; }; @@ -91,19 +91,19 @@ class TargetDebugTab final : public DebugTab void logic() override final; private: - Label *mTargetLabel; - Label *mTargetIdLabel; - Label *mTargetTypeLabel; - Label *mTargetLevelLabel; - Label *mTargetRaceLabel; - Label *mTargetPartyLabel; - Label *mTargetGuildLabel; - Label *mAttackDelayLabel; - Label *mMinHitLabel; - Label *mMaxHitLabel; - Label *mCriticalHitLabel; - Label *mKarmaLabel; - Label *mMannerLabel; + Label *mTargetLabel A_NONNULLPOINTER; + Label *mTargetIdLabel A_NONNULLPOINTER; + Label *mTargetTypeLabel A_NONNULLPOINTER; + Label *mTargetLevelLabel A_NONNULLPOINTER; + Label *mTargetRaceLabel A_NONNULLPOINTER; + Label *mTargetPartyLabel A_NONNULLPOINTER; + Label *mTargetGuildLabel A_NONNULLPOINTER; + Label *mAttackDelayLabel A_NONNULLPOINTER; + Label *mMinHitLabel A_NONNULLPOINTER; + Label *mMaxHitLabel A_NONNULLPOINTER; + Label *mCriticalHitLabel A_NONNULLPOINTER; + Label *mKarmaLabel A_NONNULLPOINTER; + Label *mMannerLabel A_NONNULLPOINTER; }; class NetDebugTab final : public DebugTab @@ -118,9 +118,9 @@ class NetDebugTab final : public DebugTab void logic() override final; private: - Label *mPingLabel; - Label *mInPackets1Label; - Label *mOutPackets1Label; + Label *mPingLabel A_NONNULLPOINTER; + Label *mInPackets1Label A_NONNULLPOINTER; + Label *mOutPackets1Label A_NONNULLPOINTER; }; #endif // GUI_WIDGETS_TABS_DEBUGWINDOWTABS_H diff --git a/src/gui/widgets/tabs/setup_colors.h b/src/gui/widgets/tabs/setup_colors.h index e6620eb83..7f75394e8 100644 --- a/src/gui/widgets/tabs/setup_colors.h +++ b/src/gui/widgets/tabs/setup_colors.h @@ -55,32 +55,32 @@ class Setup_Colors final : public SetupTab, private: static const char *const rawmsg; - ListBox *mColorBox; - ScrollArea *mScroll; - BrowserBox *mPreview; - TextPreview *mTextPreview; - ScrollArea *mPreviewBox; + ListBox *mColorBox A_NONNULLPOINTER; + ScrollArea *mScroll A_NONNULLPOINTER; + BrowserBox *mPreview A_NONNULLPOINTER; + TextPreview *mTextPreview A_NONNULLPOINTER; + ScrollArea *mPreviewBox A_NONNULLPOINTER; int mSelected; - Label *mGradTypeLabel; - Slider *mGradTypeSlider; - Label *mGradTypeText; + Label *mGradTypeLabel A_NONNULLPOINTER; + Slider *mGradTypeSlider A_NONNULLPOINTER; + Label *mGradTypeText A_NONNULLPOINTER; - Label *mGradDelayLabel; - Slider *mGradDelaySlider; - TextField *mGradDelayText; + Label *mGradDelayLabel A_NONNULLPOINTER; + Slider *mGradDelaySlider A_NONNULLPOINTER; + TextField *mGradDelayText A_NONNULLPOINTER; - Label *mRedLabel; - Slider *mRedSlider; - TextField *mRedText; + Label *mRedLabel A_NONNULLPOINTER; + Slider *mRedSlider A_NONNULLPOINTER; + TextField *mRedText A_NONNULLPOINTER; - Label *mGreenLabel; - Slider *mGreenSlider; - TextField *mGreenText; + Label *mGreenLabel A_NONNULLPOINTER; + Slider *mGreenSlider A_NONNULLPOINTER; + TextField *mGreenText A_NONNULLPOINTER; - Label *mBlueLabel; - Slider *mBlueSlider; - TextField *mBlueText; + Label *mBlueLabel A_NONNULLPOINTER; + Slider *mBlueSlider A_NONNULLPOINTER; + TextField *mBlueText A_NONNULLPOINTER; static void setEntry(Slider *const s, TextField *const t, const int value); diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp index cc33a2971..44fcb3fab 100644 --- a/src/gui/widgets/tabs/setup_joystick.cpp +++ b/src/gui/widgets/tabs/setup_joystick.cpp @@ -51,14 +51,14 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : mCalibrateButton(new Button(this, _("Calibrate"), "calibrate", this)), // TRANSLATORS: joystick settings tab button mDetectButton(new Button(this, _("Detect joysticks"), "detect", this)), - mOriginalJoystickEnabled(config.getBoolValue("joystickEnabled")), // TRANSLATORS: joystick settings tab checkbox mJoystickEnabled(new CheckBox(this, _("Enable joystick"))), mNamesModel(new NamesModel), mNamesDropDown(new DropDown(this, mNamesModel)), // TRANSLATORS: joystick settings tab checkbox mUseInactiveCheckBox(new CheckBox(this, _("Use joystick if client " - "window inactive"), config.getBoolValue("useInactiveJoystick"))) + "window inactive"), config.getBoolValue("useInactiveJoystick"))), + mOriginalJoystickEnabled(config.getBoolValue("joystickEnabled")) { // TRANSLATORS: joystick settings tab name setName(_("Joystick")); diff --git a/src/gui/widgets/tabs/setup_joystick.h b/src/gui/widgets/tabs/setup_joystick.h index cef0fc132..bc2aaa2a0 100644 --- a/src/gui/widgets/tabs/setup_joystick.h +++ b/src/gui/widgets/tabs/setup_joystick.h @@ -49,14 +49,14 @@ class Setup_Joystick final : public SetupTab void setTempEnabled(const bool sel); private: - Label *mCalibrateLabel; - Button *mCalibrateButton; - Button *mDetectButton; - bool mOriginalJoystickEnabled; - CheckBox *mJoystickEnabled; - NamesModel *mNamesModel; - DropDown *mNamesDropDown; - CheckBox *mUseInactiveCheckBox; + Label *mCalibrateLabel A_NONNULLPOINTER; + Button *mCalibrateButton A_NONNULLPOINTER; + Button *mDetectButton A_NONNULLPOINTER; + CheckBox *mJoystickEnabled A_NONNULLPOINTER; + NamesModel *mNamesModel A_NONNULLPOINTER; + DropDown *mNamesDropDown A_NONNULLPOINTER; + CheckBox *mUseInactiveCheckBox A_NONNULLPOINTER; + bool mOriginalJoystickEnabled A_NONNULLPOINTER; }; #endif // GUI_WIDGETS_TABS_SETUP_JOYSTICK_H diff --git a/src/gui/widgets/tabs/setup_theme.h b/src/gui/widgets/tabs/setup_theme.h index 45f3bc90d..312e0e82c 100644 --- a/src/gui/widgets/tabs/setup_theme.h +++ b/src/gui/widgets/tabs/setup_theme.h @@ -52,61 +52,61 @@ class Setup_Theme final : public SetupTab private: Label *mThemeLabel; - ThemesModel *mThemesModel; + ThemesModel *mThemesModel A_NONNULLPOINTER; DropDown *mThemeDropDown; std::string mTheme; ThemeInfo *mInfo; - FontsModel *mFontsModel; - Label *mFontLabel; - DropDown *mFontDropDown; + FontsModel *mFontsModel A_NONNULLPOINTER; + Label *mFontLabel A_NONNULLPOINTER; + DropDown *mFontDropDown A_NONNULLPOINTER; std::string mFont; - LangListModel *mLangListModel; + LangListModel *mLangListModel A_NONNULLPOINTER; - Label *mLangLabel; - DropDown *mLangDropDown; + Label *mLangLabel A_NONNULLPOINTER; + DropDown *mLangDropDown A_NONNULLPOINTER; std::string mLang; - Label *mBoldFontLabel; - DropDown *mBoldFontDropDown; + Label *mBoldFontLabel A_NONNULLPOINTER; + DropDown *mBoldFontDropDown A_NONNULLPOINTER; std::string mBoldFont; - Label *mParticleFontLabel; - DropDown *mParticleFontDropDown; + Label *mParticleFontLabel A_NONNULLPOINTER; + DropDown *mParticleFontDropDown A_NONNULLPOINTER; std::string mParticleFont; - Label *mHelpFontLabel; - DropDown *mHelpFontDropDown; + Label *mHelpFontLabel A_NONNULLPOINTER; + DropDown *mHelpFontDropDown A_NONNULLPOINTER; std::string mHelpFont; - Label *mSecureFontLabel; - DropDown *mSecureFontDropDown; + Label *mSecureFontLabel A_NONNULLPOINTER; + DropDown *mSecureFontDropDown A_NONNULLPOINTER; std::string mSecureFont; - Label *mNpcFontLabel; - DropDown *mNpcFontDropDown; + Label *mNpcFontLabel A_NONNULLPOINTER; + DropDown *mNpcFontDropDown A_NONNULLPOINTER; std::string mNpcFont; - Label *mJapanFontLabel; - DropDown *mJapanFontDropDown; + Label *mJapanFontLabel A_NONNULLPOINTER; + DropDown *mJapanFontDropDown A_NONNULLPOINTER; std::string mJapanFont; - Label *mChinaFontLabel; - DropDown *mChinaFontDropDown; + Label *mChinaFontLabel A_NONNULLPOINTER; + DropDown *mChinaFontDropDown A_NONNULLPOINTER; std::string mChinaFont; - FontSizeChoiceListModel *mFontSizeListModel; + FontSizeChoiceListModel *mFontSizeListModel A_NONNULLPOINTER; Label *mFontSizeLabel; int mFontSize; DropDown *mFontSizeDropDown; - FontSizeChoiceListModel *mNpcFontSizeListModel; + FontSizeChoiceListModel *mNpcFontSizeListModel A_NONNULLPOINTER; Label *mNpcFontSizeLabel; int mNpcFontSize; - DropDown *mNpcFontSizeDropDown; + DropDown *mNpcFontSizeDropDown A_NONNULLPOINTER; - Button *mInfoButton; + Button *mInfoButton A_NONNULLPOINTER; std::string mThemeInfo; }; diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index ded1e6709..d999c8fe5 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -208,8 +208,7 @@ class Tab notfinal : public BasicContainer, virtual void setCurrent() { } - Label* mLabel; - + Label* mLabel A_NONNULLPOINTER; TabbedArea* mTabbedArea; @@ -232,7 +231,7 @@ class Tab notfinal : public BasicContainer, const Color *mPlayerFlashColor; const Color *mPlayerFlashOutlineColor; int mFlash; - ImageCollection *mVertexes; + ImageCollection *mVertexes A_NONNULLPOINTER; Image *mImage; int mMode; int mLabelMode; diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index ae1e922c9..07ff9bf94 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -688,7 +688,7 @@ class Window notfinal : public BasicContainer2, * where two borders are moved at the same time. */ static const unsigned resizeBorderWidth = 10; - ImageCollection *mVertexes; + ImageCollection *mVertexes A_NONNULLPOINTER; int mCaptionOffsetX; int mCaptionOffsetY; Graphics::Alignment mCaptionAlign; @@ -699,7 +699,7 @@ class Window notfinal : public BasicContainer2, int mClosePadding; int mStickySpacing; int mStickyPadding; - Font *mCaptionFont; + Font *mCaptionFont A_NONNULLPOINTER; Modal mModal; /**< Window is modal */ bool mShowTitle; /**< Window has a title bar */ bool mCloseWindowButton; /**< Window has a close button */ diff --git a/src/gui/windows/confirmdialog.h b/src/gui/windows/confirmdialog.h index 2b3951dad..91132b641 100644 --- a/src/gui/windows/confirmdialog.h +++ b/src/gui/windows/confirmdialog.h @@ -64,7 +64,7 @@ class ConfirmDialog notfinal : public Window, void postInit() override final; private: - TextBox *mTextBox; + TextBox *mTextBox A_NONNULLPOINTER; bool mIgnore; }; diff --git a/src/gui/windows/editdialog.h b/src/gui/windows/editdialog.h index ef77fcdcd..f76b163b7 100644 --- a/src/gui/windows/editdialog.h +++ b/src/gui/windows/editdialog.h @@ -66,7 +66,7 @@ class EditDialog final : public Window, private: std::string mEventOk; - TextField *mTextField; + TextField *mTextField A_NONNULLPOINTER; }; #endif // GUI_WINDOWS_EDITDIALOG_H diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 062ac6bce..eca01ab05 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -128,7 +128,7 @@ class InventoryWindow final : public Window, void slotsChanged(Inventory *const inventory) override final; bool isMainInventory() const A_WARN_UNUSED - { return mInventory->isMainInventory(); } + { return mInventory ? mInventory->isMainInventory() : false; } /** * Returns true if any instances exist. @@ -174,7 +174,7 @@ class InventoryWindow final : public Window, static WindowList invInstances; Inventory *mInventory; - ItemContainer *mItems; + ItemContainer *mItems A_NONNULLPOINTER; Button *mUseButton; Button *mDropButton; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 89b614e8d..9c1cbc618 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -115,6 +115,8 @@ void SkillDialog::action(const ActionEvent &event) const std::string &eventId = event.getId(); if (eventId == "inc") { + if (!playerHandler) + return; const SkillTab *const tab = static_cast<const SkillTab *const>( mTabs->getSelectedTab()); if (tab) diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 7c8329ce9..29cc69165 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -145,11 +145,11 @@ class SkillDialog final : public Window, typedef std::map<int, SkillInfo*> SkillMap; SkillMap mSkills; std::vector<SkillInfo*> mDurations; - TabbedArea *mTabs; + TabbedArea *mTabs A_NONNULLPOINTER; std::list<Tab*> mDeleteTabs; - Label *mPointsLabel; - Button *mUseButton; - Button *mIncreaseButton; + Label *mPointsLabel A_NONNULLPOINTER; + Button *mUseButton A_NONNULLPOINTER; + Button *mIncreaseButton A_NONNULLPOINTER; SkillModel *mDefaultModel; }; |