summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-07 17:55:36 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-07 21:38:21 +0300
commitffeffa2314dbe03e0ced58e0c465760b54908690 (patch)
tree3da4d65e43a4b55aed7c01ec612c9dec50d1bd1c /src
parentae550d179c25e149f7e8a8d70011b364fb0d85d6 (diff)
downloadplus-ffeffa2314dbe03e0ced58e0c465760b54908690.tar.gz
plus-ffeffa2314dbe03e0ced58e0c465760b54908690.tar.bz2
plus-ffeffa2314dbe03e0ced58e0c465760b54908690.tar.xz
plus-ffeffa2314dbe03e0ced58e0c465760b54908690.zip
fix cide style.
Add explicit keyword to some constructors.
Diffstat (limited to 'src')
-rw-r--r--src/actorsprite.h2
-rw-r--r--src/animatedsprite.h2
-rw-r--r--src/avatar.h2
-rw-r--r--src/being.h2
-rw-r--r--src/client.h2
-rw-r--r--src/depricatedevent.h2
-rw-r--r--src/gui/botcheckerwindow.cpp2
-rw-r--r--src/gui/buyselldialog.h4
-rw-r--r--src/gui/debugwindow.h8
-rw-r--r--src/gui/inventorywindow.h2
-rw-r--r--src/gui/logindialog.cpp2
-rw-r--r--src/gui/setup_relations.cpp2
-rw-r--r--src/gui/socialwindow.cpp2
-rw-r--r--src/gui/whoisonline.cpp5
-rw-r--r--src/gui/widgets/chattab.cpp2
-rw-r--r--src/gui/widgets/guildchattab.h2
-rw-r--r--src/gui/worldselectdialog.cpp4
-rw-r--r--src/guild.h2
-rw-r--r--src/inventory.h2
-rw-r--r--src/item.h7
-rw-r--r--src/itemshortcut.h2
-rw-r--r--src/joystick.h2
-rw-r--r--src/localplayer.h2
-rw-r--r--src/map.h2
-rw-r--r--src/maplayer.h2
-rw-r--r--src/net/ea/loginhandler.cpp2
-rw-r--r--src/net/eathena/loginhandler.cpp2
-rw-r--r--src/net/tmwa/loginhandler.cpp2
-rw-r--r--src/particle.h2
-rw-r--r--src/particlecontainer.h12
-rw-r--r--src/party.h2
-rw-r--r--src/playerrelations.h2
-rw-r--r--src/resources/dye.h2
-rw-r--r--src/resources/sdlmusic.h2
-rw-r--r--src/resources/soundeffect.h2
-rw-r--r--src/simpleanimation.h6
-rw-r--r--src/textcommand.h2
-rw-r--r--src/utils/xml.h3
-rw-r--r--src/variabledata.h8
39 files changed, 58 insertions, 59 deletions
diff --git a/src/actorsprite.h b/src/actorsprite.h
index a09191dfc..d11205bd1 100644
--- a/src/actorsprite.h
+++ b/src/actorsprite.h
@@ -68,7 +68,7 @@ public:
NUM_TCT
};
- ActorSprite(const int id);
+ explicit ActorSprite(const int id);
A_DELETE_COPY(ActorSprite)
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index 2d8a55f26..a742a8f25 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -42,7 +42,7 @@ class AnimatedSprite final : public Sprite
* Constructor.
* @param sprite the sprite to animate
*/
- AnimatedSprite(SpriteDef *const sprite);
+ explicit AnimatedSprite(SpriteDef *const sprite);
A_DELETE_COPY(AnimatedSprite)
diff --git a/src/avatar.h b/src/avatar.h
index be72ebb10..2e84360d3 100644
--- a/src/avatar.h
+++ b/src/avatar.h
@@ -35,7 +35,7 @@ enum AvatarType
class Avatar
{
public:
- Avatar(const std::string &name = "");
+ explicit Avatar(const std::string &name = "");
A_DELETE_COPY(Avatar)
diff --git a/src/being.h b/src/being.h
index 7c8fcb173..43bb3b188 100644
--- a/src/being.h
+++ b/src/being.h
@@ -75,7 +75,7 @@ enum Gender
class BeingEquipBackend final : public Equipment::Backend
{
public:
- BeingEquipBackend(Being *const being);
+ explicit BeingEquipBackend(Being *const being);
A_DELETE_COPY(BeingEquipBackend)
diff --git a/src/client.h b/src/client.h
index ee495d9a9..d1a3aa047 100644
--- a/src/client.h
+++ b/src/client.h
@@ -201,7 +201,7 @@ public:
short serverPort;
};
- Client(const Options &options);
+ explicit Client(const Options &options);
A_DELETE_COPY(Client)
diff --git a/src/depricatedevent.h b/src/depricatedevent.h
index b46de1647..611611bbf 100644
--- a/src/depricatedevent.h
+++ b/src/depricatedevent.h
@@ -52,7 +52,7 @@ class DepricatedEvent final
// String passed can be retivered with getName()
// and is to used to identify what type of event
// this is.
- DepricatedEvent(const DepricatedEvents name) :
+ explicit DepricatedEvent(const DepricatedEvents name) :
mDepricatedEventName(name)
{ }
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 458da93c9..ec6125db4 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -62,7 +62,7 @@ class UsersTableModel final : public TableModel,
public Widget2
{
public:
- UsersTableModel(const Widget2 *const widget) :
+ explicit UsersTableModel(const Widget2 *const widget) :
TableModel(),
Widget2(widget),
mPlayers(0)
diff --git a/src/gui/buyselldialog.h b/src/gui/buyselldialog.h
index d6cef9192..371e8bdd9 100644
--- a/src/gui/buyselldialog.h
+++ b/src/gui/buyselldialog.h
@@ -43,9 +43,9 @@ class BuySellDialog final : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- BuySellDialog(const int npcId);
+ explicit BuySellDialog(const int npcId);
- BuySellDialog(std::string nick);
+ explicit BuySellDialog(std::string nick);
A_DELETE_COPY(BuySellDialog)
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 14265a6cc..7fd94f990 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -37,7 +37,7 @@ class DebugTab : public Container
friend class DebugWindow;
public:
- DebugTab(const Widget2 *const widget) :
+ explicit DebugTab(const Widget2 *const widget) :
Container(widget)
{ }
@@ -56,7 +56,7 @@ class MapDebugTab final : public DebugTab
friend class DebugWindow;
public:
- MapDebugTab(const Widget2 *const widget);
+ explicit MapDebugTab(const Widget2 *const widget);
A_DELETE_COPY(MapDebugTab)
@@ -85,7 +85,7 @@ class TargetDebugTab final : public DebugTab
friend class DebugWindow;
public:
- TargetDebugTab(const Widget2 *const widget);
+ explicit TargetDebugTab(const Widget2 *const widget);
A_DELETE_COPY(TargetDebugTab)
@@ -110,7 +110,7 @@ class NetDebugTab final : public DebugTab
friend class DebugWindow;
public:
- NetDebugTab(const Widget2 *const widget);
+ explicit NetDebugTab(const Widget2 *const widget);
A_DELETE_COPY(NetDebugTab)
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index b6bcbd304..83e26948b 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -62,7 +62,7 @@ class InventoryWindow final : public Window,
/**
* Constructor.
*/
- InventoryWindow(Inventory *const inventory);
+ explicit InventoryWindow(Inventory *const inventory);
A_DELETE_COPY(InventoryWindow)
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index d5cfd7ca7..f1f8bc200 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -98,7 +98,7 @@ class UpdateTypeModel final : public gcn::ListModel
class UpdateListModel final : public gcn::ListModel
{
public:
- UpdateListModel(LoginData *const data) :
+ explicit UpdateListModel(LoginData *const data) :
gcn::ListModel(),
mLoginData(data)
{
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 5387b0aab..77aa3b1b9 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -94,7 +94,7 @@ public:
class PlayerTableModel final : public Widget2, public TableModel
{
public:
- PlayerTableModel(const Widget2 *const widget) :
+ explicit PlayerTableModel(const Widget2 *const widget) :
Widget2(widget),
TableModel(),
mPlayers(nullptr),
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 6514f5922..dde6b30f2 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -99,7 +99,7 @@ public:
protected:
friend class SocialWindow;
- SocialTab(const Widget2 *const widget):
+ explicit SocialTab(const Widget2 *const widget):
Tab(widget),
mInviteDialog(nullptr),
mConfirmDialog(nullptr),
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index 84f0fd2f5..6a5ae8f70 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -490,15 +490,12 @@ int WhoIsOnline::downloadThread(void *ptr)
{
int attempts = 0;
WhoIsOnline *wio = reinterpret_cast<WhoIsOnline *>(ptr);
- CURL *curl;
CURLcode res;
-
std::string url(Client::getServerName() + "/online.txt");
while (attempts < 1 && !wio->mDownloadComplete)
{
- curl = curl_easy_init();
-
+ CURL *curl = curl_easy_init();
if (curl)
{
if (!wio->mAllowUpdate)
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 9d936755c..fc3e4e69f 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -459,9 +459,9 @@ int ChatTab::getType() const
void ChatTab::addRow(std::string &line)
{
- size_t idx = 0;
if (line.find("[@@http") == std::string::npos)
{
+ size_t idx = 0;
for (size_t f = 0; f < line.length(); f++)
{
if (line.at(f) == ' ')
diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h
index c1605495d..6daada229 100644
--- a/src/gui/widgets/guildchattab.h
+++ b/src/gui/widgets/guildchattab.h
@@ -31,7 +31,7 @@
class GuildChatTab final : public ChatTab, public ConfigListener
{
public:
- GuildChatTab(const Widget2 *const widget);
+ explicit GuildChatTab(const Widget2 *const widget);
A_DELETE_COPY(GuildChatTab)
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index b62311555..efdc7ba4b 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -49,8 +49,8 @@ extern WorldInfo **server_info;
class WorldListModel final : public gcn::ListModel
{
public:
- WorldListModel(Worlds worlds):
- mWorlds(worlds)
+ explicit WorldListModel(Worlds worlds) :
+ mWorlds(worlds)
{
}
diff --git a/src/guild.h b/src/guild.h
index c4bcb47be..e29e2a4f6 100644
--- a/src/guild.h
+++ b/src/guild.h
@@ -202,7 +202,7 @@ private:
/**
* Constructor with guild id passed to it.
*/
- Guild(const short id);
+ explicit Guild(const short id);
typedef std::vector<GuildMember*> MemberList;
MemberList mMembers;
diff --git a/src/inventory.h b/src/inventory.h
index 46a0b3f58..f5a0f227c 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -66,7 +66,7 @@ class Inventory final
*
* @param size the number of items that fit in the inventory
*/
- Inventory(const int type, const int size = -1);
+ explicit Inventory(const int type, const int size = -1);
/**
* Destructor.
diff --git a/src/item.h b/src/item.h
index 3f03b7b43..0d5917bf0 100644
--- a/src/item.h
+++ b/src/item.h
@@ -40,9 +40,10 @@ class Item
/**
* Constructor.
*/
- Item(const int id = -1, const int quantity = 0, const int refine = 0,
- const unsigned char color = 1, const bool equipment = false,
- const bool equipped = false);
+ explicit Item(const int id = -1, const int quantity = 0,
+ const int refine = 0, const unsigned char color = 1,
+ const bool equipment = false,
+ const bool equipped = false);
A_DELETE_COPY(Item)
diff --git a/src/itemshortcut.h b/src/itemshortcut.h
index 605eab205..f66895b6a 100644
--- a/src/itemshortcut.h
+++ b/src/itemshortcut.h
@@ -39,7 +39,7 @@ class ItemShortcut final
/**
* Constructor.
*/
- ItemShortcut(const int number);
+ explicit ItemShortcut(const int number);
A_DELETE_COPY(ItemShortcut)
diff --git a/src/joystick.h b/src/joystick.h
index 16dc2aa72..128a41a35 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -67,7 +67,7 @@ class Joystick final
* Constructor, pass the number of the joystick the new object
* should access.
*/
- Joystick(const int no);
+ explicit Joystick(const int no);
A_DELETE_COPY(Joystick)
diff --git a/src/localplayer.h b/src/localplayer.h
index 9ce72e5e3..2213060bf 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -74,7 +74,7 @@ class LocalPlayer final : public Being,
/**
* Constructor.
*/
- LocalPlayer(const int id = 65535, const int subtype = 0);
+ explicit LocalPlayer(const int id = 65535, const int subtype = 0);
A_DELETE_COPY(LocalPlayer)
diff --git a/src/map.h b/src/map.h
index 44dd6f2c1..77689803f 100644
--- a/src/map.h
+++ b/src/map.h
@@ -85,7 +85,7 @@ struct MetaTile final
class TileAnimation final
{
public:
- TileAnimation(Animation *const ani);
+ explicit TileAnimation(Animation *const ani);
~TileAnimation();
diff --git a/src/maplayer.h b/src/maplayer.h
index b4a43529d..d934817b0 100644
--- a/src/maplayer.h
+++ b/src/maplayer.h
@@ -244,7 +244,7 @@ class MapItem final
MapItem();
- MapItem(const int type);
+ explicit MapItem(const int type);
MapItem(const int type, std::string comment);
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index ea4452528..33c9ec45f 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -164,7 +164,7 @@ void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const
void LoginHandler::processUpdateHost(Net::MessageIn &msg)
{
- int len = msg.readInt16() - 4;
+ const int len = msg.readInt16() - 4;
mUpdateHost = msg.readString(len);
if (!checkPath(mUpdateHost))
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index d0aa9b808..cda6c0c1a 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -176,7 +176,7 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const
{
- int len = msg.readInt16() - 4;
+ const int len = msg.readInt16() - 4;
const std::string updateHost = msg.readString(len);
splitToStringVector(loginData.updateHosts, updateHost, '|');
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index b68980969..fca7e904c 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -213,7 +213,7 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const
{
- int len = msg.readInt16() - 4;
+ const int len = msg.readInt16() - 4;
const std::string updateHost = msg.readString(len);
splitToStringVector(loginData.updateHosts, updateHost, '|');
diff --git a/src/particle.h b/src/particle.h
index fac643193..812235f0c 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -78,7 +78,7 @@ class Particle : public Actor
*
* @param map the map this particle will add itself to, may be nullptr
*/
- Particle(Map *const map);
+ explicit Particle(Map *const map);
A_DELETE_COPY(Particle)
diff --git a/src/particlecontainer.h b/src/particlecontainer.h
index d499fa84c..a85c2da50 100644
--- a/src/particlecontainer.h
+++ b/src/particlecontainer.h
@@ -44,8 +44,8 @@ public:
*
* delParent means that the destructor should also free the parent.
*/
- ParticleContainer(ParticleContainer *const parent = nullptr,
- const bool delParent = true);
+ explicit ParticleContainer(ParticleContainer *const parent = nullptr,
+ const bool delParent = true);
A_DELETE_COPY(ParticleContainer)
@@ -78,8 +78,8 @@ protected:
class ParticleList final : public ParticleContainer
{
public:
- ParticleList(ParticleContainer *const parent = nullptr,
- const bool delParent = true);
+ explicit ParticleList(ParticleContainer *const parent = nullptr,
+ const bool delParent = true);
A_DELETE_COPY(ParticleList)
@@ -109,8 +109,8 @@ protected:
class ParticleVector final : public ParticleContainer
{
public:
- ParticleVector(ParticleContainer *const parent = nullptr,
- const bool delParent = true);
+ explicit ParticleVector(ParticleContainer *const parent = nullptr,
+ const bool delParent = true);
A_DELETE_COPY(ParticleVector)
diff --git a/src/party.h b/src/party.h
index e9da47a80..ffc21b852 100644
--- a/src/party.h
+++ b/src/party.h
@@ -165,7 +165,7 @@ private:
/**
* Constructor with party id passed to it.
*/
- Party(const short id);
+ explicit Party(const short id);
virtual ~Party();
diff --git a/src/playerrelations.h b/src/playerrelations.h
index ff28b5c83..219068f6e 100644
--- a/src/playerrelations.h
+++ b/src/playerrelations.h
@@ -62,7 +62,7 @@ struct PlayerRelation final
ENEMY2 = 6
};
- PlayerRelation(const Relation relation);
+ explicit PlayerRelation(const Relation relation);
A_DELETE_COPY(PlayerRelation)
diff --git a/src/resources/dye.h b/src/resources/dye.h
index 16f476399..557e8524e 100644
--- a/src/resources/dye.h
+++ b/src/resources/dye.h
@@ -102,7 +102,7 @@ class Dye final
* The parts of string are separated by semi-colons. Each part starts
* by an uppercase letter, followed by a colon and then a palette name.
*/
- Dye(const std::string &dye);
+ explicit Dye(const std::string &dye);
A_DELETE_COPY(Dye)
diff --git a/src/resources/sdlmusic.h b/src/resources/sdlmusic.h
index 5b60ebb64..8d2b24044 100644
--- a/src/resources/sdlmusic.h
+++ b/src/resources/sdlmusic.h
@@ -73,7 +73,7 @@ class SDLMusic final : public Resource
/**
* Constructor.
*/
- SDLMusic(Mix_Music *const music);
+ explicit SDLMusic(Mix_Music *const music);
Mix_Music *mMusic;
};
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index 50ddd562d..20164a397 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -69,7 +69,7 @@ class SoundEffect final : public Resource
/**
* Constructor.
*/
- SoundEffect(Mix_Chunk *const soundEffect) :
+ explicit SoundEffect(Mix_Chunk *const soundEffect) :
Resource(),
mChunk(soundEffect)
{ }
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index a0dc60a72..61a4ef152 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -45,13 +45,13 @@ class SimpleAnimation final
* Creates a simple animation with an already created \a animation.
* Takes ownership over the given animation.
*/
- SimpleAnimation(Animation *const animation);
+ explicit SimpleAnimation(Animation *const animation);
/**
* Creates a simple animation that creates its animation from XML Data.
*/
- SimpleAnimation(const XmlNodePtr animationNode,
- const std::string& dyePalettes = std::string());
+ explicit SimpleAnimation(const XmlNodePtr animationNode,
+ const std::string& dyePalettes);
A_DELETE_COPY(SimpleAnimation)
diff --git a/src/textcommand.h b/src/textcommand.h
index 8a1a089c1..0af4ae7e3 100644
--- a/src/textcommand.h
+++ b/src/textcommand.h
@@ -80,7 +80,7 @@ class TextCommand final
/**
* Constructor.
*/
- TextCommand(const unsigned int id);
+ explicit TextCommand(const unsigned int id);
A_DELETE_COPY(TextCommand)
diff --git a/src/utils/xml.h b/src/utils/xml.h
index a0ce23d07..43065fa62 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -65,7 +65,8 @@ namespace XML
* Constructor that attempts to load the given file through the
* resource manager. Logs errors.
*/
- Document(const std::string &filename, const bool useResman = true);
+ explicit Document(const std::string &filename,
+ const bool useResman = true);
/**
* Constructor that attempts to load an XML document from memory.
diff --git a/src/variabledata.h b/src/variabledata.h
index f20511dda..06969a089 100644
--- a/src/variabledata.h
+++ b/src/variabledata.h
@@ -47,7 +47,7 @@ class VariableData
class IntData final : public VariableData
{
public:
- IntData(const int value) :
+ explicit IntData(const int value) :
mData(value)
{ }
@@ -64,7 +64,7 @@ class IntData final : public VariableData
class StringData final : public VariableData
{
public:
- StringData(const std::string &value) :
+ explicit StringData(const std::string &value) :
mData(value)
{ }
@@ -81,7 +81,7 @@ class StringData final : public VariableData
class FloatData final : public VariableData
{
public:
- FloatData(const double value) :
+ explicit FloatData(const double value) :
mData(value)
{ }
@@ -98,7 +98,7 @@ class FloatData final : public VariableData
class BoolData final : public VariableData
{
public:
- BoolData(const bool value) :
+ explicit BoolData(const bool value) :
mData(value)
{ }