From 66479394037baa941cb06d75d3afc79ff4c717a2 Mon Sep 17 00:00:00 2001 From: Rogier Date: Tue, 10 Jan 2017 04:39:45 +0900 Subject: Performance fix + SAO factorization Original credits goes to @Rogier-5 * Merge common attributes between LuaEntitySAO & PlayerSAO to UnitSAO * Make some functions const * Improve some lists performance by returning const ref Signed-off-by: Loic Blot --- src/activeobject.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/activeobject.h') diff --git a/src/activeobject.h b/src/activeobject.h index 48f078d3f..fe6c08514 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -64,7 +64,7 @@ public: m_id(id) { } - + u16 getId() { return m_id; @@ -76,8 +76,8 @@ public: } virtual ActiveObjectType getType() const = 0; - virtual bool getCollisionBox(aabb3f *toset) = 0; - virtual bool collideWithObjects() = 0; + virtual bool getCollisionBox(aabb3f *toset) const = 0; + virtual bool collideWithObjects() const = 0; protected: u16 m_id; // 0 is invalid, "no id" }; -- cgit v1.2.3 From cf37a5569002e83cc4d6916b39118ceba134da1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Wed, 19 Apr 2017 00:36:30 +0200 Subject: Fix various variables passed by copy instead of const ref (#5610) Pointed by cppcheck --- src/activeobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/activeobject.h') diff --git a/src/activeobject.h b/src/activeobject.h index fe6c08514..71b9df514 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -43,7 +43,7 @@ enum ActiveObjectType { struct ActiveObjectMessage { - ActiveObjectMessage(u16 id_, bool reliable_=true, std::string data_=""): + ActiveObjectMessage(u16 id_, bool reliable_=true, const std::string &data_ = "") : id(id_), reliable(reliable_), datastring(data_) -- cgit v1.2.3 From ce9802266ef1def339ec2e119c59090d0fd07c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 20 May 2017 08:15:56 +0200 Subject: Various code cleanup & little performance improvement on HTTP download (#5772) * Disable or remove unused enum members/functions * Tiny code style fixes * Make some functions const * Replace ClientMediaDownloader std::unordered_map with std::map --- src/activeobject.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/activeobject.h') diff --git a/src/activeobject.h b/src/activeobject.h index 71b9df514..f349ddef3 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -28,9 +28,9 @@ enum ActiveObjectType { ACTIVEOBJECT_TYPE_TEST = 1, // Deprecated stuff ACTIVEOBJECT_TYPE_ITEM = 2, - ACTIVEOBJECT_TYPE_RAT = 3, - ACTIVEOBJECT_TYPE_OERKKI1 = 4, - ACTIVEOBJECT_TYPE_FIREFLY = 5, +// ACTIVEOBJECT_TYPE_RAT = 3, +// ACTIVEOBJECT_TYPE_OERKKI1 = 4, +// ACTIVEOBJECT_TYPE_FIREFLY = 5, ACTIVEOBJECT_TYPE_MOBV2 = 6, // End deprecated stuff ACTIVEOBJECT_TYPE_LUAENTITY = 7, -- cgit v1.2.3