summaryrefslogtreecommitdiff
path: root/src/clientiface.h
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-04-20 00:12:52 +0200
committerGitHub <noreply@github.com>2017-04-20 00:12:52 +0200
commitf98bbe193e0093aca8d8957cec82fdbd28639915 (patch)
tree19879fbca595d4e8cddfa8d7d069b7f78016a713 /src/clientiface.h
parentf3fe62a0bf9e775b3e6e838f104ab605a2238792 (diff)
downloadminetest-f98bbe193e0093aca8d8957cec82fdbd28639915.tar.gz
minetest-f98bbe193e0093aca8d8957cec82fdbd28639915.tar.bz2
minetest-f98bbe193e0093aca8d8957cec82fdbd28639915.zip
Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)
* Also remove 2 non declared but defined functions * Make some functions around const ref changes const
Diffstat (limited to 'src/clientiface.h')
-rw-r--r--src/clientiface.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/clientiface.h b/src/clientiface.h
index 403cd0420..11ebdaab6 100644
--- a/src/clientiface.h
+++ b/src/clientiface.h
@@ -324,14 +324,11 @@ public:
*/
std::set<u16> m_known_objects;
- ClientState getState()
- { return m_state; }
+ ClientState getState() const { return m_state; }
- std::string getName()
- { return m_name; }
+ std::string getName() const { return m_name; }
- void setName(std::string name)
- { m_name = name; }
+ void setName(const std::string &name) { m_name = name; }
/* update internal client state */
void notifyEvent(ClientStateEvent event);
@@ -350,7 +347,8 @@ public:
u32 uptime();
/* set version information */
- void setVersionInfo(u8 major, u8 minor, u8 patch, std::string full) {
+ void setVersionInfo(u8 major, u8 minor, u8 patch, const std::string &full)
+ {
m_version_major = major;
m_version_minor = minor;
m_version_patch = patch;
@@ -358,10 +356,10 @@ public:
}
/* read version information */
- u8 getMajor() { return m_version_major; }
- u8 getMinor() { return m_version_minor; }
- u8 getPatch() { return m_version_patch; }
- std::string getVersion() { return m_full_version; }
+ u8 getMajor() const { return m_version_major; }
+ u8 getMinor() const { return m_version_minor; }
+ u8 getPatch() const { return m_version_patch; }
+ std::string getVersion() const { return m_full_version; }
private:
// Version is stored in here after INIT before INIT2
u8 m_pending_serialization_version;