From d406ac994b8092c5bd2dc32eda1a2eafbf95a30c Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Fri, 21 Nov 2014 14:43:29 +1000 Subject: Optimise functions from CNodeDefManager and VoxelManipulator CNodeDefManager::get() VoxelManipulator::addArea() --- src/nodedef.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/nodedef.cpp') diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 51e71a052..deb08fda9 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -389,8 +389,8 @@ public: virtual ~CNodeDefManager(); void clear(); virtual IWritableNodeDefManager *clone(); - virtual const ContentFeatures& get(content_t c) const; - virtual const ContentFeatures& get(const MapNode &n) const; + inline virtual const ContentFeatures& get(content_t c) const; + inline virtual const ContentFeatures& get(const MapNode &n) const; virtual bool getId(const std::string &name, content_t &result) const; virtual content_t getId(const std::string &name) const; virtual void getIds(const std::string &name, std::set &result) const; @@ -530,16 +530,14 @@ IWritableNodeDefManager *CNodeDefManager::clone() } -const ContentFeatures& CNodeDefManager::get(content_t c) const +inline const ContentFeatures& CNodeDefManager::get(content_t c) const { - if (c < m_content_features.size()) - return m_content_features[c]; - else - return m_content_features[CONTENT_UNKNOWN]; + return c < m_content_features.size() + ? m_content_features[c] : m_content_features[CONTENT_UNKNOWN]; } -const ContentFeatures& CNodeDefManager::get(const MapNode &n) const +inline const ContentFeatures& CNodeDefManager::get(const MapNode &n) const { return get(n.getContent()); } -- cgit v1.2.3