From 4d5ce8478c959a4ee5b13ef9ba7e46b28d089a21 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Thu, 25 May 2017 16:43:55 +0200 Subject: Enhance ABM performance a little bit by removing two std::set copy (#5815) * Enhance ABM performance a little bit by removing two std::set copy * ActiveBlockModifier::getTriggerContents now returns a const ref * ActiveBlockModifier::getRequiredNeighbors now returns a const ref * ActiveBlockModifier::getRequiredNeighbors is now purely virtual * Little code style fix --- src/serverenvironment.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/serverenvironment.h') diff --git a/src/serverenvironment.h b/src/serverenvironment.h index 0e31aa41a..7c370fd54 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -51,11 +51,10 @@ public: virtual ~ActiveBlockModifier(){}; // Set of contents to trigger on - virtual std::set getTriggerContents()=0; + virtual const std::set &getTriggerContents() const = 0; // Set of required neighbors (trigger doesn't happen if none are found) // Empty = do not check neighbors - virtual std::set getRequiredNeighbors() - { return std::set(); } + virtual const std::set &getRequiredNeighbors() const = 0; // Trigger interval in seconds virtual float getTriggerInterval() = 0; // Random chance of (1 / return value), 0 is disallowed -- cgit v1.2.3