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/serverobject.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/serverobject.h') diff --git a/src/serverobject.h b/src/serverobject.h index 9884eb0a1..9e8b5a779 100644 --- a/src/serverobject.h +++ b/src/serverobject.h @@ -146,8 +146,8 @@ public: virtual void setArmorGroups(const ItemGroupList &armor_groups) {} - virtual ItemGroupList getArmorGroups() - { return ItemGroupList(); } + virtual const ItemGroupList &getArmorGroups() + { static const ItemGroupList rv; return rv; } virtual void setPhysicsOverride(float physics_override_speed, float physics_override_jump, float physics_override_gravity) {} virtual void setAnimation(v2f frames, float frame_speed, float frame_blend, bool frame_loop) @@ -166,8 +166,8 @@ public: {} virtual void removeAttachmentChild(int child_id) {} - virtual UNORDERED_SET getAttachmentChildIds() - { return UNORDERED_SET(); } + virtual const UNORDERED_SET &getAttachmentChildIds() + { static const UNORDERED_SET rv; return rv; } virtual ObjectProperties* accessObjectProperties() { return NULL; } virtual void notifyObjectPropertiesModified() -- cgit v1.2.3