C++11 implement function deleting, it's generally used to prevent some object copy
In script API use this function removal on ScriptApiBase instead of ScriptApiClient/Server/MainMenu, this affect all ScriptApis
Move DISABLE_CLASS_COPY with constructor, the deleted function permit to replace function in its original place
);
~Client();
+ DISABLE_CLASS_COPY(Client);
void initMods();
GameUIFlags *m_game_ui_flags;
bool m_shutdown;
- DISABLE_CLASS_COPY(Client);
};
#endif // !CLIENT_HEADER
// Methods
EmergeManager(Server *server);
~EmergeManager();
+ DISABLE_CLASS_COPY(EmergeManager);
bool initMapgens(MapgenParams *mgparams);
Mapgen *getCurrentMapgen();
// Mapgen helpers methods
- Biome *getBiomeAtPoint(v3s16 p);
int getSpawnLevelAtPoint(v2s16 p);
int getGroundLevelAtPoint(v2s16 p);
bool isBlockUnderground(v3s16 blockpos);
bool popBlockEmergeData(v3s16 pos, BlockEmergeData *bedata);
friend class EmergeThread;
-
- DISABLE_CLASS_COPY(EmergeManager);
};
#endif
// Environment will delete the map passed to the constructor
Environment(IGameDef *gamedef);
virtual ~Environment();
+ DISABLE_CLASS_COPY(Environment);
/*
Step everything in environment.
private:
std::mutex m_time_lock;
-
- DISABLE_CLASS_COPY(Environment);
};
#endif
Map(std::ostream &dout, IGameDef *gamedef);
virtual ~Map();
-
- /*virtual u16 nodeContainerId() const
- {
- return NODECONTAINER_ID_MAP;
- }*/
+ DISABLE_CLASS_COPY(Map);
virtual s32 mapType() const
{
u32 m_unprocessed_count;
u64 m_inc_trending_up_start_time; // milliseconds
bool m_queue_size_timer_started;
-
- DISABLE_CLASS_COPY(Map);
};
/*
Mapgen();
Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge);
virtual ~Mapgen();
+ DISABLE_CLASS_COPY(Mapgen);
virtual MapgenType getType() const { return MAPGEN_INVALID; }
// that checks whether there are floodable nodes without liquid beneath
// the node at index vi.
inline bool isLiquidHorizontallyFlowable(u32 vi, v3s16 em);
- DISABLE_CLASS_COPY(Mapgen);
};
/*
public:
ObjDefManager(IGameDef *gamedef, ObjDefType type);
virtual ~ObjDefManager();
+ DISABLE_CLASS_COPY(ObjDefManager);
virtual const char *getObjectTitle() const { return "ObjDef"; }
INodeDefManager *m_ndef;
std::vector<ObjDef *> m_objects;
ObjDefType m_objtype;
-
-private:
- DISABLE_CLASS_COPY(ObjDefManager);
};
#endif
#include <iostream>
#include <string>
+#include "util/basic_macros.h"
extern "C" {
#include <lua.h>
public:
ScriptApiBase();
virtual ~ScriptApiBase();
+ DISABLE_CLASS_COPY(ScriptApiBase);
// These throw a ModError on failure
void loadMod(const std::string &script_path, const std::string &mod_name);
#include "cpp_api/s_base.h"
#include "cpp_api/s_client.h"
#include "cpp_api/s_security.h"
-#include "util/basic_macros.h"
class Client;
class LocalPlayer;
private:
virtual void InitializeModApi(lua_State *L, int top);
- DISABLE_CLASS_COPY(ClientScripting);
};
#endif
#include "cpp_api/s_base.h"
#include "cpp_api/s_mainmenu.h"
#include "cpp_api/s_async.h"
-#include "util/basic_macros.h"
/*****************************************************************************/
/* Scripting <-> Main Menu Interface */
static void registerLuaClasses(lua_State *L, int top);
AsyncEngine asyncEngine;
- DISABLE_CLASS_COPY(MainMenuScripting);
};
#include "cpp_api/s_player.h"
#include "cpp_api/s_server.h"
#include "cpp_api/s_security.h"
-#include "util/basic_macros.h"
/*****************************************************************************/
/* Scripting <-> Server Game Interface */
private:
void InitializeModApi(lua_State *L, int top);
- DISABLE_CLASS_COPY(ServerScripting);
};
void log_deprecated(const std::string &message);
ChatInterface *iface = NULL
);
~Server();
+ DISABLE_CLASS_COPY(Server);
+
void start(Address bind_addr);
void stop();
// This is mainly a way to pass the time to the server.
std::unordered_map<std::string, ModMetadata *> m_mod_storages;
float m_mod_storage_save_timer;
-
- DISABLE_CLASS_COPY(Server);
};
/*
// 'Foobar', add the macro DISABLE_CLASS_COPY(Foobar) as a private member.
// Note this also disables copying for any classes derived from 'Foobar' as well
// as classes having a 'Foobar' member.
-#define DISABLE_CLASS_COPY(C) \
- C(const C &); \
- C &operator=(const C &)
+#define DISABLE_CLASS_COPY(C) \
+ C(const C &) = delete; \
+ C &operator=(const C &) = delete;
#ifndef _MSC_VER
#define UNUSED_ATTRIBUTE __attribute__ ((unused))