summaryrefslogtreecommitdiff
path: root/src/serverenvironment.h
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-05-25 16:43:55 +0200
committerGitHub <noreply@github.com>2017-05-25 16:43:55 +0200
commit4d5ce8478c959a4ee5b13ef9ba7e46b28d089a21 (patch)
treed635cf0dfd7b5040c7c24378ac4c25e59cf48f61 /src/serverenvironment.h
parent5b338638e0e5743d8acfb48b72e17b671968722f (diff)
downloadminetest-4d5ce8478c959a4ee5b13ef9ba7e46b28d089a21.tar.gz
minetest-4d5ce8478c959a4ee5b13ef9ba7e46b28d089a21.tar.bz2
minetest-4d5ce8478c959a4ee5b13ef9ba7e46b28d089a21.zip
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
Diffstat (limited to 'src/serverenvironment.h')
-rw-r--r--src/serverenvironment.h5
1 files changed, 2 insertions, 3 deletions
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<std::string> getTriggerContents()=0;
+ virtual const std::set<std::string> &getTriggerContents() const = 0;
// Set of required neighbors (trigger doesn't happen if none are found)
// Empty = do not check neighbors
- virtual std::set<std::string> getRequiredNeighbors()
- { return std::set<std::string>(); }
+ virtual const std::set<std::string> &getRequiredNeighbors() const = 0;
// Trigger interval in seconds
virtual float getTriggerInterval() = 0;
// Random chance of (1 / return value), 0 is disallowed