diff options
Diffstat (limited to 'src/gui')
38 files changed, 113 insertions, 190 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 46f28fe8..1637d001 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -104,7 +104,7 @@ class CharacterDisplay : public Container private: void update(); - Net::Character *mCharacter; + Net::Character *mCharacter = nullptr; PlayerBox *mPlayerBox; Label *mName; @@ -347,7 +347,6 @@ bool CharSelectDialog::selectByName(const std::string &name, CharacterDisplay::CharacterDisplay(CharSelectDialog *charSelectDialog): - mCharacter(nullptr), mPlayerBox(new PlayerBox) { mButton = new Button("", "go", charSelectDialog); diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index 5cf9d464..104f1283 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -44,11 +44,7 @@ const int EmotePopup::gridHeight = 36; // emote icon height + 4 static const int MAX_COLUMNS = 6; -EmotePopup::EmotePopup(): - mSelectedEmoteIndex(-1), - mHoveredEmoteIndex(-1), - mRowCount(1), - mColumnCount(1) +EmotePopup::EmotePopup() { // Setup emote sprites for (int i = 0; i <= EmoteDB::getLast(); ++i) diff --git a/src/gui/emotepopup.h b/src/gui/emotepopup.h index cb1c7b89..ee905cd6 100644 --- a/src/gui/emotepopup.h +++ b/src/gui/emotepopup.h @@ -107,11 +107,11 @@ class EmotePopup : public Popup std::vector<const ImageSprite*> mEmotes; Image *mSelectionImage; - int mSelectedEmoteIndex; - int mHoveredEmoteIndex; + int mSelectedEmoteIndex = -1; + int mHoveredEmoteIndex = -1; - int mRowCount; - int mColumnCount; + int mRowCount = 1; + int mColumnCount = 1; using Listeners = std::list<gcn::SelectionListener *>; diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 4d1d5291..45f3dcd1 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -52,10 +52,7 @@ static const int BOX_HEIGHT = 36; EquipmentWindow::EquipmentWindow(Equipment *equipment): Window(_("Equipment")), - mEquipBox(nullptr), - mSelected(-1), - mEquipment(equipment), - mBoxesNumber(0) + mEquipment(equipment) { mItemPopup = new ItemPopup; setupWindow->registerWindowForReset(this); diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index 1bfc5f00..19630e0b 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -71,22 +71,16 @@ class EquipmentWindow : public Window, public gcn::ActionListener */ struct EquipBox { - EquipBox() : - posX(0), - posY(0), - backgroundImage(nullptr) - {} - - int posX; - int posY; - Image* backgroundImage; + int posX = 0; + int posY = 0; + Image *backgroundImage = nullptr; }; - EquipBox *mEquipBox; /**< Equipment Boxes. */ + EquipBox *mEquipBox = nullptr; /**< Equipment Boxes. */ - int mSelected; /**< Index of selected item. */ + int mSelected = -1; /**< Index of selected item. */ Equipment *mEquipment; - int mBoxesNumber; /**< Number of equipment boxes to display */ + int mBoxesNumber = 0; /**< Number of equipment boxes to display */ private: void mouseExited(gcn::MouseEvent &event) override; diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index e5f6b00c..8f810622 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -59,8 +59,7 @@ InventoryWindow::WindowList InventoryWindow::instances; InventoryWindow::InventoryWindow(Inventory *inventory): Window(inventory->isMainInventory() ? _("Inventory") : _("Storage")), mInventory(inventory), - mFilterText(new TextField), - mSplit(false) + mFilterText(new TextField) { listen(Event::AttributesChannel); diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 389312b3..048b229c 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -141,7 +141,7 @@ class InventoryWindow : public Window, ProgressBar *mWeightBar, *mSlotsBar; - bool mSplit; + bool mSplit = false; }; extern InventoryWindow *inventoryWindow; diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 966e2c92..3979c4f2 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -82,8 +82,7 @@ static gcn::Color getColorFromItemType(ItemType type) } ItemPopup::ItemPopup(): - Popup("ItemPopup"), - mIcon(nullptr) + Popup("ItemPopup") { // Item Name mItemName = new Label; diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 3b213633..39270ba1 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -72,7 +72,7 @@ class ItemPopup : public Popup TextBox *mItemWeight; std::string mItemEquipSlot; ItemType mItemType; - Icon *mIcon; + Icon *mIcon = nullptr; }; #endif // ITEMPOPUP_H diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 388a032a..7d6cc618 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -42,11 +42,7 @@ bool Minimap::mShow = true; Minimap::Minimap(): - Window(_("Map")), - mMap(nullptr), - mMapImage(nullptr), - mWidthProportion(0.5), - mHeightProportion(0.5) + Window(_("Map")) { setWindowName("Minimap"); mShow = config.getValue(getWindowName() + "Show", true); diff --git a/src/gui/minimap.h b/src/gui/minimap.h index 3a122230..6eb051ef 100644 --- a/src/gui/minimap.h +++ b/src/gui/minimap.h @@ -58,10 +58,10 @@ class Minimap : public Window void draw(gcn::Graphics *graphics) override; private: - Map *mMap; - Image *mMapImage; - float mWidthProportion; - float mHeightProportion; + Map *mMap = nullptr; + Image *mMapImage = nullptr; + float mWidthProportion = 0.5; + float mHeightProportion = 0.5; static bool mShow; }; diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 8b348480..13e1ac0d 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -73,10 +73,7 @@ NpcDialog::DialogList NpcDialog::instances; NpcDialog::NpcDialog(int npcId) : Window(_("NPC")), mNpcId(npcId), - mLogInteraction(config.getBoolValue("logNpcInGui")), - mDefaultInt(0), - mInputState(NPC_INPUT_NONE), - mActionState(NPC_ACTION_WAIT) + mLogInteraction(config.getBoolValue("logNpcInGui")) { // Basic Window Setup setWindowName("NpcText"); diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 49ec5f8a..fc0325a4 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -177,7 +177,7 @@ class NpcDialog : public Window, int mNpcId; bool mLogInteraction; - int mDefaultInt; + int mDefaultInt = 0; std::string mDefaultString; // Used for the main input area @@ -221,8 +221,8 @@ class NpcDialog : public Window, NPC_ACTION_CLOSE }; - NpcInputState mInputState; - NpcActionState mActionState; + NpcInputState mInputState = NPC_INPUT_NONE; + NpcActionState mActionState = NPC_ACTION_WAIT; }; #endif // NPCDIALOG_H diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index cd6c7d3d..d1e060f0 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -48,15 +48,7 @@ #include <vector> OutfitWindow::OutfitWindow(): - Window(_("Outfits")), - mBoxWidth(33), - mBoxHeight(33), - mGridWidth(3), - mGridHeight(3), - mItemClicked(false), - mItemMoved(nullptr), - mItemSelected(-1), - mCurrentOutfit(0) + Window(_("Outfits")) { setWindowName("Outfits"); setResizable(true); diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h index c5e24b9b..a7f50b47 100644 --- a/src/gui/outfitwindow.h +++ b/src/gui/outfitwindow.h @@ -72,20 +72,21 @@ class OutfitWindow : public Window, gcn::ActionListener int getIndexFromGrid(int pointX, int pointY) const; - int mBoxWidth; - int mBoxHeight; + int mBoxWidth = 33; + int mBoxHeight = 33; int mCursorPosX, mCursorPosY; - int mGridWidth, mGridHeight; - bool mItemClicked; - Item *mItemMoved; + int mGridWidth = 3; + int mGridHeight = 3; + bool mItemClicked = false; + Item *mItemMoved = nullptr; void save(); int mItems[OUTFITS_COUNT][OUTFIT_ITEM_COUNT]; bool mItemsUnequip[OUTFITS_COUNT]; - int mItemSelected; + int mItemSelected = -1; - int mCurrentOutfit; + int mCurrentOutfit = 0; }; extern OutfitWindow *outfitWindow; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index d63fe2f3..d7a34005 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -55,10 +55,7 @@ std::string tradePartnerName; PopupMenu::PopupMenu(): - Popup("PopupMenu"), - mBeingId(0), - mFloorItem(nullptr), - mItem(nullptr) + Popup("PopupMenu") { mBrowserBox = new BrowserBox; mBrowserBox->setPosition(4, 4); diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index c5be561d..640d1d1e 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -65,9 +65,9 @@ class PopupMenu : public Popup, public LinkHandler private: BrowserBox* mBrowserBox; - int mBeingId; - FloorItem* mFloorItem; - Item *mItem; + int mBeingId = 0; + FloorItem *mFloorItem = nullptr; + Item *mItem = nullptr; Window *mWindow; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 6eb58a36..bcc53ccf 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -62,8 +62,6 @@ SDLInput::SDLInput() { - mMouseInWindow = true; - mMouseDown = false; } bool SDLInput::isKeyQueueEmpty() diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 09bb788e..4fe5be44 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -202,8 +202,8 @@ protected: std::queue<gcn::MouseInput> mMouseInputQueue; std::queue<TextInput> mTextInputQueue; - bool mMouseDown; - bool mMouseInWindow; + bool mMouseDown = false; + bool mMouseInWindow = true; }; #endif diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index 76a4b3ac..38730862 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -48,7 +48,7 @@ SellDialog::DialogList SellDialog::instances; SellDialog::SellDialog(int npcId): Window(_("Sell")), - mNpcId(npcId), mMaxItems(0), mAmountItems(0) + mNpcId(npcId) { setWindowName("Sell"); //setupWindow->registerWindowForReset(this); diff --git a/src/gui/selldialog.h b/src/gui/selldialog.h index 7e37d860..d59343cb 100644 --- a/src/gui/selldialog.h +++ b/src/gui/selldialog.h @@ -108,10 +108,10 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener gcn::Slider *mSlider; ShopItems *mShopItems; - int mPlayerMoney; + int mPlayerMoney = 0; - int mMaxItems; - int mAmountItems; + int mMaxItems = 0; + int mAmountItems = 0; }; #endif diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 6a7f6ab5..cc1fa26a 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -175,9 +175,6 @@ public: ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): Window(_("Choose Your Server")), mDir(dir), - mDownloadStatus(DOWNLOADING_PREPARING), - mDownloadProgress(-1.0f), - mServers(ServerInfos()), mServerInfo(serverInfo) { setWindowName("ServerDialog"); diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index d0ef0e55..4bb201a5 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -159,13 +159,13 @@ class ServerDialog : public Window, }; /** Status of the current download. */ - ServerDialogDownloadStatus mDownloadStatus; + ServerDialogDownloadStatus mDownloadStatus = DOWNLOADING_PREPARING; - Net::Download *mDownload; - Label *mDownloadText; + Net::Download *mDownload = nullptr; + Label *mDownloadText; Mutex mMutex; - float mDownloadProgress; + float mDownloadProgress = -1.0f; ServerInfos mServers; ServerInfo *mServerInfo; diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index 529e69a5..17e59845 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -86,7 +86,6 @@ class PlayerTableModel : public TableModel { public: PlayerTableModel() : - mPlayers(nullptr), mListModel(new PlayerRelationListModel) { playerRelationsUpdated(); @@ -175,7 +174,7 @@ public: } protected: - std::vector<std::string> *mPlayers; + std::vector<std::string> *mPlayers = nullptr; std::vector<gcn::Widget *> mWidgets; PlayerRelationListModel *mListModel; }; diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 7f42b016..74a5b2c4 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -64,10 +64,10 @@ struct SkillInfo { unsigned short id; std::string name; - Image *icon; + Image *icon = nullptr; bool modifiable; bool visible; - SkillModel *model; + SkillModel *model = nullptr; std::string skillLevel; int skillLevelWidth; @@ -76,10 +76,6 @@ struct SkillInfo float progress; gcn::Color color; - SkillInfo() : - icon(nullptr) - {} - ~SkillInfo() { if (icon) diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index d58d12ad..f7af65c2 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -53,10 +53,7 @@ class SocialTab : public Tab protected: friend class SocialWindow; - SocialTab(): - mInviteDialog(nullptr), - mConfirmDialog(nullptr) - {} + SocialTab() = default; ~SocialTab() override { @@ -80,8 +77,8 @@ protected: virtual void leave() = 0; - TextDialog *mInviteDialog; - ConfirmDialog *mConfirmDialog; + TextDialog *mInviteDialog = nullptr; + ConfirmDialog *mConfirmDialog = nullptr; ScrollArea *mScroll; AvatarListBox *mList; }; @@ -90,7 +87,7 @@ class GuildTab : public SocialTab, public gcn::ActionListener { public: GuildTab(Guild *guild): - mGuild(guild) + mGuild(guild) { setCaption(guild->getName()); diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index 339835fc..1104aa05 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -59,10 +59,10 @@ class SpecialEntry : public Container SpecialInfo *mInfo; private: - Icon *mIcon; // icon to display - Label *mNameLabel; // name to display - Button *mUse; // use button (only shown when applicable) - ProgressBar *mRechargeBar; // recharge bar (only shown when applicable) + Icon *mIcon = nullptr; // icon to display + Label *mNameLabel = nullptr; // name to display + Button *mUse = nullptr; // use button (only shown when applicable) + ProgressBar *mRechargeBar = nullptr; // recharge bar (only shown when applicable) }; SpecialsWindow::SpecialsWindow(): @@ -175,10 +175,7 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData) SpecialEntry::SpecialEntry(SpecialInfo *info) : - mInfo(info), - mIcon(nullptr), - mUse(nullptr), - mRechargeBar(nullptr) + mInfo(info) { setSize(SPECIALS_WIDTH, SPECIALS_HEIGHT); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index c2486b89..ef6ca62e 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -87,7 +87,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener private: void action(const gcn::ActionEvent &event) override; - int mNeeded; + int mNeeded = 1; Label *mPoints; Button *mDec; @@ -461,7 +461,7 @@ DerDisplay::DerDisplay(int id, const std::string &name): } ChangeDisplay::ChangeDisplay(int id, const std::string &name): - AttrDisplay(id, name), mNeeded(1) + AttrDisplay(id, name) { mPoints = new Label(_("Max")); mInc = new Button(_("+"), "inc", this); diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 76706849..1fd76bdf 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -37,7 +37,7 @@ class TextChunk { public: TextChunk(const std::string &text, const gcn::Color &color) : - img(nullptr), text(text), color(color) + text(text), color(color) { } @@ -75,7 +75,7 @@ class TextChunk SDL_FreeSurface(surface); } - Image *img; + Image *img = nullptr; std::string text; gcn::Color color; }; diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 1964c1bf..bedaa9da 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -123,19 +123,9 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, const std::string &updatesDir, bool applyUpdates): Window(_("Updating...")), - mDownloadStatus(UPDATE_NEWS), mUpdateHost(updateHost), mUpdatesDir(updatesDir), mCurrentFile("news.txt"), - mDownloadProgress(0.0f), - mCurrentChecksum(0), - mStoreInMemory(true), - mDownloadComplete(true), - mUserCancel(false), - mDownloadedBytes(0), - mMemoryBuffer(nullptr), - mDownload(nullptr), - mUpdateIndex(0), mLoadUpdates(applyUpdates) { setWindowName("UpdaterWindow"); diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h index faf7a9a5..6c69cd9b 100644 --- a/src/gui/updaterwindow.h +++ b/src/gui/updaterwindow.h @@ -134,7 +134,7 @@ private: }; /** Status of the current download. */ - UpdateDownloadStatus mDownloadStatus; + UpdateDownloadStatus mDownloadStatus = UPDATE_NEWS; /** Host where we get the updated files. */ std::string mUpdateHost; @@ -149,37 +149,37 @@ private: std::string mNewLabelCaption; /** The new progress value to be set in the logic method. */ - float mDownloadProgress; + float mDownloadProgress = 0.0f; /** The mutex used to guard access to mNewLabelCaption and mDownloadProgress. */ Mutex mDownloadMutex; /** The Adler32 checksum of the file currently downloading. */ - unsigned long mCurrentChecksum; + unsigned long mCurrentChecksum = 0; /** A flag to indicate whether to use a memory buffer or a regular file. */ - bool mStoreInMemory; + bool mStoreInMemory = true; /** Flag that show if current download is complete. */ - bool mDownloadComplete; + bool mDownloadComplete = true; /** Flag that show if the user has canceled the update. */ - bool mUserCancel; + bool mUserCancel = false; /** Byte count currently downloaded in mMemoryBuffer. */ - int mDownloadedBytes; + int mDownloadedBytes = 0; /** Buffer for files downloaded to memory. */ - char *mMemoryBuffer; + char *mMemoryBuffer = nullptr; /** Download handle. */ - Net::Download *mDownload; + Net::Download *mDownload = nullptr; /** List of files to download. */ std::vector<updateFile> mUpdateFiles; /** Index of the file to be downloaded. */ - unsigned int mUpdateIndex; + unsigned int mUpdateIndex = 0; /** Tells ~UpdaterWindow() if it should load updates */ bool mLoadUpdates; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 456196ce..0cadb9fc 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -47,17 +47,7 @@ extern volatile int tick_time; -Viewport::Viewport(): - mMap(nullptr), - mMouseX(0), - mMouseY(0), - mPixelViewX(0.0f), - mPixelViewY(0.0f), - mDebugFlags(0), - mPlayerFollowMouse(false), - mLocalWalkTime(-1), - mHoverBeing(nullptr), - mHoverItem(nullptr) +Viewport::Viewport() { setOpaque(false); addMouseListener(this); diff --git a/src/gui/viewport.h b/src/gui/viewport.h index f3f82ce5..96c8afd3 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -190,17 +190,17 @@ class Viewport : public WindowContainer, public gcn::MouseListener, */ void updateCursorType(); - Map *mMap; /**< The current map. */ + Map *mMap = nullptr; /**< The current map. */ int mScrollRadius; int mScrollLaziness; int mScrollCenterOffsetX; int mScrollCenterOffsetY; - int mMouseX; /**< Current mouse position in pixels. */ - int mMouseY; /**< Current mouse position in pixels. */ - float mPixelViewX; /**< Current viewpoint in pixels. */ - float mPixelViewY; /**< Current viewpoint in pixels. */ - int mDebugFlags; /**< Flags for showing debug graphics. */ + int mMouseX = 0; /**< Current mouse position in pixels. */ + int mMouseY = 0; /**< Current mouse position in pixels. */ + float mPixelViewX = 0.0f; /**< Current viewpoint in pixels. */ + float mPixelViewY = 0.0f; /**< Current viewpoint in pixels. */ + int mDebugFlags = 0; /**< Flags for showing debug graphics. */ struct ShakeEffect { @@ -212,14 +212,14 @@ class Viewport : public WindowContainer, public gcn::MouseListener, using ShakeEffects = std::list<ShakeEffect>; ShakeEffects mShakeEffects; - bool mPlayerFollowMouse; + bool mPlayerFollowMouse = false; - int mLocalWalkTime; /**< Timestamp before the next walk can be sent. */ + int mLocalWalkTime = -1; /**< Timestamp before the next walk can be sent. */ PopupMenu *mPopupMenu; /**< Popup menu. */ - Being *mHoverBeing; /**< Being mouse is currently over. */ - FloorItem *mHoverItem; /**< FloorItem mouse is currently over. */ - BeingPopup *mBeingPopup; /**< Being information popup. */ + Being *mHoverBeing = nullptr; /**< Being mouse is currently over. */ + FloorItem *mHoverItem = nullptr; /**< FloorItem mouse is currently over. */ + BeingPopup *mBeingPopup; /**< Being information popup. */ }; extern Viewport *viewport; /**< The viewport. */ diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 2fe3b5b1..bc424962 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -36,19 +36,8 @@ #include <algorithm> BrowserBox::BrowserBox(unsigned int mode, bool opaque): - gcn::Widget(), - mMode(mode), mHighMode(UNDERLINE | BACKGROUND), - mShadows(false), - mOutline(false), - mOpaque(opaque), - mUseLinksAndUserColors(true), - mSelectedLink(-1), - mMaxRows(0), - mHeight(0), - mWidth(0), - mYStart(0), - mUpdateTime(-1), - mAlwaysUpdate(true) + mMode(mode), + mOpaque(opaque) { setFocusable(true); addMouseListener(this); @@ -58,7 +47,7 @@ BrowserBox::~BrowserBox() { } -void BrowserBox::setLinkHandler(LinkHandler* linkHandler) +void BrowserBox::setLinkHandler(LinkHandler *linkHandler) { mLinkHandler = linkHandler; } @@ -244,20 +233,24 @@ void BrowserBox::clearRows() struct MouseOverLink { - MouseOverLink(int x, int y) : mX(x), mY(y) - { } + MouseOverLink(int x, int y) + : mX(x), mY(y) + {} bool operator() (BrowserLink &link) const { return (mX >= link.x1 && mX < link.x2 && mY >= link.y1 && mY < link.y2); } + int mX, mY; }; void BrowserBox::mousePressed(gcn::MouseEvent &event) { - if (!mLinkHandler) return; + if (!mLinkHandler) + return; + auto i = find_if(mLinks.begin(), mLinks.end(), MouseOverLink(event.getX(), event.getY())); diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 5f29e72a..6d09f77b 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -198,20 +198,20 @@ class BrowserBox : public gcn::Widget, using LinkIterator = Links::iterator; Links mLinks; - LinkHandler *mLinkHandler; + LinkHandler *mLinkHandler = nullptr; unsigned int mMode; - unsigned int mHighMode; - bool mShadows; - bool mOutline; + unsigned int mHighMode = UNDERLINE | BACKGROUND; + bool mShadows = false; + bool mOutline = false; bool mOpaque; - bool mUseLinksAndUserColors; - int mSelectedLink; - unsigned int mMaxRows; - int mHeight; - int mWidth; - int mYStart; - int mUpdateTime; - bool mAlwaysUpdate; + bool mUseLinksAndUserColors = true; + int mSelectedLink = -1; + unsigned int mMaxRows = 0; + int mHeight = 0; + int mWidth = 0; + int mYStart = 0; + int mUpdateTime = -1; + bool mAlwaysUpdate = true; }; #endif diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 8fd7a405..1c6faf89 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -167,7 +167,7 @@ class LayoutCell LEFT, RIGHT, CENTER, FILL }; - LayoutCell(): mType(NONE) {} + LayoutCell() = default; ~LayoutCell(); @@ -263,7 +263,7 @@ class LayoutCell char mExtent[2]; char mAlign[2]; char mNbFill[2]; - char mType; + char mType = NONE; }; /** diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 0da51928..aff7c5c5 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -45,8 +45,7 @@ extern Window *setupWindow; extern Window *statusWindow; extern Window *socialWindow; -WindowMenu::WindowMenu(): - mEmotePopup(nullptr) +WindowMenu::WindowMenu() { int x = 0, h = 0; diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index 92b3b9b4..0eabc247 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -60,7 +60,7 @@ class WindowMenu : public Container, KeyboardConfig::KeyAction key = KeyboardConfig::KEY_NO_VALUE); - EmotePopup *mEmotePopup; + EmotePopup *mEmotePopup = nullptr; }; #endif |