summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.h21
-rw-r--r--src/configuration.h4
-rw-r--r--src/equipment.h6
-rw-r--r--src/gui/charselectdialog.cpp3
-rw-r--r--src/gui/emotepopup.cpp6
-rw-r--r--src/gui/emotepopup.h8
-rw-r--r--src/gui/equipmentwindow.cpp5
-rw-r--r--src/gui/equipmentwindow.h18
-rw-r--r--src/gui/inventorywindow.cpp3
-rw-r--r--src/gui/inventorywindow.h2
-rw-r--r--src/gui/itempopup.cpp3
-rw-r--r--src/gui/itempopup.h2
-rw-r--r--src/gui/minimap.cpp6
-rw-r--r--src/gui/minimap.h8
-rw-r--r--src/gui/npcdialog.cpp5
-rw-r--r--src/gui/npcdialog.h6
-rw-r--r--src/gui/outfitwindow.cpp10
-rw-r--r--src/gui/outfitwindow.h15
-rw-r--r--src/gui/popupmenu.cpp5
-rw-r--r--src/gui/popupmenu.h6
-rw-r--r--src/gui/sdlinput.cpp2
-rw-r--r--src/gui/sdlinput.h4
-rw-r--r--src/gui/selldialog.cpp2
-rw-r--r--src/gui/selldialog.h6
-rw-r--r--src/gui/serverdialog.cpp3
-rw-r--r--src/gui/serverdialog.h8
-rw-r--r--src/gui/setup_players.cpp3
-rw-r--r--src/gui/skilldialog.cpp8
-rw-r--r--src/gui/socialwindow.cpp11
-rw-r--r--src/gui/specialswindow.cpp13
-rw-r--r--src/gui/statuswindow.cpp4
-rw-r--r--src/gui/truetypefont.cpp4
-rw-r--r--src/gui/updaterwindow.cpp10
-rw-r--r--src/gui/updaterwindow.h20
-rw-r--r--src/gui/viewport.cpp12
-rw-r--r--src/gui/viewport.h22
-rw-r--r--src/gui/widgets/browserbox.cpp27
-rw-r--r--src/gui/widgets/browserbox.h24
-rw-r--r--src/gui/widgets/layout.h4
-rw-r--r--src/gui/windowmenu.cpp3
-rw-r--r--src/gui/windowmenu.h2
-rw-r--r--src/map.h6
-rw-r--r--src/net/charhandler.h22
-rw-r--r--src/net/manaserv/connection.cpp3
-rw-r--r--src/net/manaserv/connection.h6
-rw-r--r--src/net/manaserv/inventoryhandler.h21
-rw-r--r--src/particleemitterprop.h22
-rw-r--r--src/resources/hairdb.h10
-rw-r--r--src/resources/imageset.cpp14
-rw-r--r--src/resources/imageset.h8
-rw-r--r--src/resources/itemdb.h9
-rw-r--r--src/resources/iteminfo.h12
-rw-r--r--src/resources/resource.h10
53 files changed, 174 insertions, 303 deletions
diff --git a/src/client.h b/src/client.h
index fbfcabf8..09233a5c 100644
--- a/src/client.h
+++ b/src/client.h
@@ -129,20 +129,11 @@ public:
*/
struct Options
{
- Options():
- printHelp(false),
- printVersion(false),
- skipUpdate(false),
- chooseDefault(false),
- noOpenGL(false),
- serverPort(0)
- {}
-
- bool printHelp;
- bool printVersion;
- bool skipUpdate;
- bool chooseDefault;
- bool noOpenGL;
+ bool printHelp = false;
+ bool printVersion = false;
+ bool skipUpdate = false;
+ bool chooseDefault = false;
+ bool noOpenGL = false;
std::string username;
std::string password;
std::string character;
@@ -155,7 +146,7 @@ public:
std::string screenshotDir;
std::string serverName;
- short serverPort;
+ short serverPort = 0;
};
Client(const Options &options);
diff --git a/src/configuration.h b/src/configuration.h
index 49ea7c20..cd56be05 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -192,7 +192,7 @@ class ConfigurationObject
class Configuration : public ConfigurationObject
{
public:
- Configuration() : mDefaultsData(nullptr) {}
+ Configuration() = default;
~Configuration() override;
@@ -258,7 +258,7 @@ class Configuration : public ConfigurationObject
void cleanDefaults();
std::string mConfigPath; /**< Location of config file */
- DefaultsData *mDefaultsData; /**< Defaults of value for a given key */
+ DefaultsData *mDefaultsData = nullptr; /**< Defaults of value for a given key */
};
extern Configuration branding;
diff --git a/src/equipment.h b/src/equipment.h
index 71a15734..726f7f5e 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -29,9 +29,7 @@ class Item;
class Equipment
{
public:
- Equipment(): mBackend(nullptr) {}
-
- ~Equipment() { mBackend = nullptr; }
+ Equipment() = default;
class Backend {
public:
@@ -78,7 +76,7 @@ class Equipment
{ mBackend = backend; }
private:
- Backend *mBackend;
+ Backend *mBackend = nullptr;
};
#endif
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
diff --git a/src/map.h b/src/map.h
index 410ae16e..4e054bdb 100644
--- a/src/map.h
+++ b/src/map.h
@@ -49,16 +49,14 @@ const int DEFAULT_TILE_LENGTH = 32;
*/
struct MetaTile
{
- MetaTile() : whichList(0), blockmask(0) {}
-
// Pathfinding members
int Fcost; /**< Estimation of total path cost */
int Gcost; /**< Cost from start to this location */
int Hcost; /**< Estimated cost to goal */
- unsigned whichList; /**< No list, open list or closed list */
+ unsigned whichList = 0; /**< No list, open list or closed list */
int parentX; /**< X coordinate of parent tile */
int parentY; /**< Y coordinate of parent tile */
- unsigned char blockmask; /**< Blocking properties of this tile */
+ unsigned char blockmask = 0; /**< Blocking properties of this tile */
};
/**
diff --git a/src/net/charhandler.h b/src/net/charhandler.h
index 4b108cac..ee8f2298 100644
--- a/src/net/charhandler.h
+++ b/src/net/charhandler.h
@@ -38,19 +38,13 @@ namespace Net {
*/
struct Character
{
- Character() :
- slot(0),
- dummy(nullptr)
- {
- }
-
~Character()
{
delete dummy;
}
- int slot; /**< The index in the list of characters */
- LocalPlayer *dummy; /**< A dummy representing this character */
+ int slot = 0; /**< The index in the list of characters */
+ LocalPlayer *dummy = nullptr; /**< A dummy representing this character */
PlayerInfoBackend data;
};
@@ -96,11 +90,7 @@ class CharHandler
virtual int getCharCreateMaxHairStyleId() const = 0;
protected:
- CharHandler():
- mSelectedCharacter(nullptr),
- mCharSelectDialog(nullptr),
- mCharCreateDialog(nullptr)
- {}
+ CharHandler() = default;
void updateCharSelectDialog();
void unlockCharSelectDialog();
@@ -109,10 +99,10 @@ class CharHandler
Net::Characters mCharacters;
/** The selected character. */
- Net::Character *mSelectedCharacter;
+ Net::Character *mSelectedCharacter = nullptr;
- CharSelectDialog *mCharSelectDialog;
- CharCreateDialog *mCharCreateDialog;
+ CharSelectDialog *mCharSelectDialog = nullptr;
+ CharCreateDialog *mCharCreateDialog = nullptr;
};
} // namespace Net
diff --git a/src/net/manaserv/connection.cpp b/src/net/manaserv/connection.cpp
index 4bc57695..d439f964 100644
--- a/src/net/manaserv/connection.cpp
+++ b/src/net/manaserv/connection.cpp
@@ -32,9 +32,8 @@ namespace ManaServ
{
Connection::Connection(ENetHost *client):
- mConnection(nullptr), mClient(client)
+ mClient(client)
{
- mPort = 0;
connections++;
}
diff --git a/src/net/manaserv/connection.h b/src/net/manaserv/connection.h
index 42932c47..e6646e0e 100644
--- a/src/net/manaserv/connection.h
+++ b/src/net/manaserv/connection.h
@@ -72,10 +72,10 @@ namespace ManaServ
friend Connection *ManaServ::getConnection();
Connection(ENetHost *client);
- short mPort;
- ENetPeer *mConnection;
+ short mPort = 0;
+ ENetPeer *mConnection = nullptr;
ENetHost *mClient;
- State mState;
+ State mState = OK;
};
}
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
index 3659286b..7ed1b9d5 100644
--- a/src/net/manaserv/inventoryhandler.h
+++ b/src/net/manaserv/inventoryhandler.h
@@ -71,43 +71,34 @@ class EquipBackend : public Equipment::Backend, public EventListener
void readBoxNode(xmlNodePtr slotNode);
struct Slot {
- Slot():
- item(nullptr),
- slotTypeId(0),
- subId(0),
- itemInstance(0),
- weaponSlot(false),
- ammoSlot(false)
- {}
-
// Generic info
std::string name;
// The Item reference, used for graphical representation
// and info.
- Item *item;
+ Item *item = nullptr;
// Manaserv specific info
// Used to know which (server-side) slot id it is.
- unsigned int slotTypeId;
+ unsigned int slotTypeId = 0;
// Static part
// The sub id is used to know in which order the slots are
// when the slotType has more than one slot capacity:
// I.e.: capacity = 6, subId will be between 1 and 6
// for each slots in the map.
// This is used to sort the multimap along with the slot id.
- unsigned int subId;
+ unsigned int subId = 0;
// This is the (per character) unique item Id, used especially when
// equipping the same item multiple times on the same slot type.
- unsigned int itemInstance;
+ unsigned int itemInstance = 0;
// Tell whether the slot is a weapon slot
- bool weaponSlot;
+ bool weaponSlot = false;
// Tell whether the slot is an ammo slot
- bool ammoSlot;
+ bool ammoSlot = false;
};
unsigned int mVisibleSlots;
diff --git a/src/particleemitterprop.h b/src/particleemitterprop.h
index 2bd92d17..eb719e57 100644
--- a/src/particleemitterprop.h
+++ b/src/particleemitterprop.h
@@ -35,14 +35,10 @@ enum ChangeFunc
template <typename T> struct ParticleEmitterProp
{
- ParticleEmitterProp():
- changeFunc(FUNC_NONE)
- {
- }
-
void set(T min, T max)
{
- minVal=min; maxVal=max;
+ minVal = min;
+ maxVal = max;
}
void set(T val)
@@ -66,24 +62,24 @@ template <typename T> struct ParticleEmitterProp
switch (changeFunc)
{
case FUNC_SINE:
- val += (T) std::sin(PI * 2 * ((double)(tick%changePeriod) / (double)changePeriod)) * changeAmplitude;
+ val += (T) std::sin(PI * 2 * ((double)(tick % changePeriod) / (double)changePeriod)) * changeAmplitude;
break;
case FUNC_SAW:
- val += (T) (changeAmplitude * ((double)(tick%changePeriod) / (double)changePeriod)) * 2 - changeAmplitude;
+ val += (T) (changeAmplitude * ((double)(tick % changePeriod) / (double)changePeriod)) * 2 - changeAmplitude;
break;
case FUNC_TRIANGLE:
- if ((tick%changePeriod) * 2 < changePeriod)
+ if ((tick % changePeriod) * 2 < changePeriod)
{
- val += changeAmplitude - (T)((tick%changePeriod) / (double)changePeriod) * changeAmplitude * 4;
+ val += changeAmplitude - (T)((tick % changePeriod) / (double)changePeriod) * changeAmplitude * 4;
}
else
{
- val += changeAmplitude * -3 + (T)((tick%changePeriod) / (double)changePeriod) * changeAmplitude * 4;
+ val += changeAmplitude * -3 + (T)((tick % changePeriod) / (double)changePeriod) * changeAmplitude * 4;
// I have no idea why this works but it does
}
break;
case FUNC_SQUARE:
- if ((tick%changePeriod) * 2 < changePeriod)
+ if ((tick % changePeriod) * 2 < changePeriod)
val += changeAmplitude;
else
val -= changeAmplitude;
@@ -100,7 +96,7 @@ template <typename T> struct ParticleEmitterProp
T minVal;
T maxVal;
- ChangeFunc changeFunc;
+ ChangeFunc changeFunc = FUNC_NONE;
T changeAmplitude;
int changePeriod;
int changePhase;
diff --git a/src/resources/hairdb.h b/src/resources/hairdb.h
index 65cca496..b4374985 100644
--- a/src/resources/hairdb.h
+++ b/src/resources/hairdb.h
@@ -33,10 +33,8 @@
*/
class HairDB
{
- public:
- HairDB():
- mLoaded(false)
- {}
+public:
+ HairDB() = default;
~HairDB()
{ unload(); }
@@ -74,7 +72,7 @@ class HairDB
*/
void addHairStyle(int id);
- private:
+private:
/**
* Load the hair colors, contained in a <colors> node.
*/
@@ -94,7 +92,7 @@ class HairDB
using HairStyles = std::set<int>;
HairStyles mHairStyles;
- bool mLoaded;
+ bool mLoaded = false;
};
extern HairDB hairDB;
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 74b4034f..4eec23f8 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -29,8 +29,8 @@
ImageSet::ImageSet(Image *img, int width, int height,
int margin, int spacing) :
- mOffsetX(0),
- mOffsetY(0)
+ mWidth(width),
+ mHeight(height)
{
for (int y = margin; y + height <= img->getHeight() - margin; y += height + spacing)
{
@@ -39,8 +39,6 @@ ImageSet::ImageSet(Image *img, int width, int height,
mImages.push_back(img->getSubImage(x, y, width, height));
}
}
- mWidth = width;
- mHeight = height;
}
ImageSet::~ImageSet()
@@ -48,15 +46,13 @@ ImageSet::~ImageSet()
delete_all(mImages);
}
-Image* ImageSet::get(size_type i) const
+Image *ImageSet::get(size_type i) const
{
if (i >= mImages.size())
{
logger->log("Warning: No sprite %d in this image set", (int) i);
return nullptr;
}
- else
- {
- return mImages[i];
- }
+
+ return mImages[i];
}
diff --git a/src/resources/imageset.h b/src/resources/imageset.h
index c73e7e37..8f377369 100644
--- a/src/resources/imageset.h
+++ b/src/resources/imageset.h
@@ -52,7 +52,7 @@ class ImageSet : public Resource
int getHeight() const { return mHeight; }
using size_type = std::vector<Image *>::size_type;
- Image* get(size_type i) const;
+ Image *get(size_type i) const;
size_type size() const { return mImages.size(); }
@@ -71,10 +71,10 @@ class ImageSet : public Resource
private:
std::vector<Image*> mImages;
- int mHeight; /**< Height of the images in the image set. */
int mWidth; /**< Width of the images in the image set. */
- int mOffsetX;
- int mOffsetY;
+ int mHeight; /**< Height of the images in the image set. */
+ int mOffsetX = 0;
+ int mOffsetY = 0;
};
#endif
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index 016e6194..d8d37bc4 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -73,10 +73,7 @@ void setStatsList(const std::list<ItemStat> &stats);
class ItemDB
{
public:
- ItemDB() :
- mUnknown(nullptr),
- mLoaded(false)
- {}
+ ItemDB() = default;
virtual ~ItemDB()
{}
@@ -126,9 +123,9 @@ class ItemDB
void loadEmptyItemDefinition();
// Default unknown reference
- ItemInfo *mUnknown;
+ ItemInfo *mUnknown = nullptr;
- bool mLoaded;
+ bool mLoaded = false;
private:
/**
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index da73bd3e..df559d69 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -81,10 +81,6 @@ class ItemInfo
public:
ItemInfo():
- mType(ITEM_UNUSABLE),
- mWeight(0),
- mView(0),
- mId(0),
mAttackAction(SpriteAction::INVALID)
{
}
@@ -159,11 +155,11 @@ class ItemInfo
std::string mName;
std::string mDescription; /**< Short description. */
std::vector<std::string> mEffect; /**< Description of effects. */
- ItemType mType; /**< Item type. */
+ ItemType mType = ITEM_UNUSABLE; /**< Item type. */
std::string mParticle; /**< Particle effect used with this item */
- int mWeight; /**< Weight in grams. */
- int mView; /**< Item ID of how this item looks. */
- int mId; /**< Item ID */
+ int mWeight = 0; /**< Weight in grams. */
+ int mView = 0; /**< Item ID of how this item looks. */
+ int mId = 0; /**< Item ID */
bool mEquippable; /**< Whether this item can be equipped. */
bool mActivatable; /**< Whether this item can be activated. */
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 988b78a5..7f1f4836 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -38,9 +38,7 @@ class Resource
DeleteImmediately
};
- Resource():
- mRefCount(0)
- {}
+ Resource() = default;
/**
* Increments the internal reference count.
@@ -64,9 +62,9 @@ class Resource
virtual ~Resource() {}
private:
- std::string mIdPath; /**< Path identifying this resource. */
- time_t mTimeStamp; /**< Time at which the resource was orphaned. */
- unsigned mRefCount; /**< Reference count. */
+ std::string mIdPath; /**< Path identifying this resource. */
+ time_t mTimeStamp; /**< Time at which the resource was orphaned. */
+ unsigned mRefCount = 0; /**< Reference count. */
};
/**