diff options
author | kwolekr <kwolekr@minetest.net> | 2015-10-27 02:51:43 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-10-27 22:05:08 -0400 |
commit | c56d7fe0eba7905b0a63c4a1cfe909988653c23d (patch) | |
tree | fd5158b3efe0a2f2b48c54afc73f7bcecb1cb9b7 /src/mapgen.h | |
parent | ca8e56c15a26bc5f3d1dffe5fd39e1ca4b82d6f8 (diff) | |
download | minetest-c56d7fe0eba7905b0a63c4a1cfe909988653c23d.tar.gz minetest-c56d7fe0eba7905b0a63c4a1cfe909988653c23d.tar.bz2 minetest-c56d7fe0eba7905b0a63c4a1cfe909988653c23d.zip |
Add DISABLE_CLASS_COPY macro (and use it)
Use this macro to disallow copying of an object using the assignment
operator or copy constructor. This catches otherwise silent-but-deadly
mistakes such as "ServerMap map = env->getMap();" at compile time.
If so desired, it is still possible to copy a class, but it now requires
an explicit call to memcpy or std::copy.
Diffstat (limited to 'src/mapgen.h')
-rw-r--r-- | src/mapgen.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mapgen.h b/src/mapgen.h index 0561ddf98..57e995847 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -182,6 +182,9 @@ public: virtual void makeChunk(BlockMakeData *data) {} virtual int getGroundLevelAtPoint(v2s16 p) { return 0; } + +private: + DISABLE_CLASS_COPY(Mapgen); }; struct MapgenFactory { |