Move make_unique into a namespace to avoid ADL issues
this prevents VS finding std::make_unique for constructors that take types from std
This commit is contained in:
parent
b9efa02c80
commit
c96849f431
@ -433,10 +433,14 @@ typename std::enable_if<std::is_arithmetic<T>::value, C>::type CeilC(T a_Value)
|
|||||||
|
|
||||||
|
|
||||||
//temporary replacement for std::make_unique until we get c++14
|
//temporary replacement for std::make_unique until we get c++14
|
||||||
template <class T, class... Args>
|
|
||||||
std::unique_ptr<T> make_unique(Args&&... args)
|
namespace cpp14
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
template <class T, class... Args>
|
||||||
|
std::unique_ptr<T> make_unique(Args&&... args)
|
||||||
|
{
|
||||||
|
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// a tick is 50 ms
|
// a tick is 50 ms
|
||||||
|
@ -133,7 +133,7 @@ void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> overridesRepo)
|
|||||||
|
|
||||||
LOG("Reading server config...");
|
LOG("Reading server config...");
|
||||||
|
|
||||||
auto IniFile = make_unique<cIniFile>();
|
auto IniFile = cpp14::make_unique<cIniFile>();
|
||||||
if (!IniFile->ReadFile("settings.ini"))
|
if (!IniFile->ReadFile("settings.ini"))
|
||||||
{
|
{
|
||||||
LOGWARN("Regenerating settings.ini, all settings will be reset");
|
LOGWARN("Regenerating settings.ini, all settings will be reset");
|
||||||
@ -141,7 +141,7 @@ void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> overridesRepo)
|
|||||||
IniFile->AddHeaderComment(" Most of the settings here can be configured using the webadmin interface, if enabled in webadmin.ini");
|
IniFile->AddHeaderComment(" Most of the settings here can be configured using the webadmin interface, if enabled in webadmin.ini");
|
||||||
IniFile->AddHeaderComment(" See: http://wiki.mc-server.org/doku.php?id=configure:settings.ini for further configuration help");
|
IniFile->AddHeaderComment(" See: http://wiki.mc-server.org/doku.php?id=configure:settings.ini for further configuration help");
|
||||||
}
|
}
|
||||||
auto settingsRepo = make_unique<cOverridesSettingsRepository>(std::move(IniFile), std::move(overridesRepo));
|
auto settingsRepo = cpp14::make_unique<cOverridesSettingsRepository>(std::move(IniFile), std::move(overridesRepo));
|
||||||
|
|
||||||
LOG("Starting server...");
|
LOG("Starting server...");
|
||||||
m_MojangAPI = new cMojangAPI;
|
m_MojangAPI = new cMojangAPI;
|
||||||
|
@ -621,18 +621,18 @@ void cWorld::Start(void)
|
|||||||
InitialiseAndLoadMobSpawningValues(IniFile);
|
InitialiseAndLoadMobSpawningValues(IniFile);
|
||||||
SetTimeOfDay(IniFile.GetValueSetI("General", "TimeInTicks", GetTimeOfDay()));
|
SetTimeOfDay(IniFile.GetValueSetI("General", "TimeInTicks", GetTimeOfDay()));
|
||||||
|
|
||||||
m_ChunkMap = make_unique<cChunkMap>(this);
|
m_ChunkMap = cpp14::make_unique<cChunkMap>(this);
|
||||||
|
|
||||||
// preallocate some memory for ticking blocks so we don't need to allocate that often
|
// preallocate some memory for ticking blocks so we don't need to allocate that often
|
||||||
m_BlockTickQueue.reserve(1000);
|
m_BlockTickQueue.reserve(1000);
|
||||||
m_BlockTickQueueCopy.reserve(1000);
|
m_BlockTickQueueCopy.reserve(1000);
|
||||||
|
|
||||||
// Simulators:
|
// Simulators:
|
||||||
m_SimulatorManager = make_unique<cSimulatorManager>(*this);
|
m_SimulatorManager = cpp14::make_unique<cSimulatorManager>(*this);
|
||||||
m_WaterSimulator = InitializeFluidSimulator(IniFile, "Water", E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER);
|
m_WaterSimulator = InitializeFluidSimulator(IniFile, "Water", E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER);
|
||||||
m_LavaSimulator = InitializeFluidSimulator(IniFile, "Lava", E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA);
|
m_LavaSimulator = InitializeFluidSimulator(IniFile, "Lava", E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA);
|
||||||
m_SandSimulator = make_unique<cSandSimulator>(*this, IniFile);
|
m_SandSimulator = cpp14::make_unique<cSandSimulator>(*this, IniFile);
|
||||||
m_FireSimulator = make_unique<cFireSimulator>(*this, IniFile);
|
m_FireSimulator = cpp14::make_unique<cFireSimulator>(*this, IniFile);
|
||||||
m_RedstoneSimulator = InitializeRedstoneSimulator(IniFile);
|
m_RedstoneSimulator = InitializeRedstoneSimulator(IniFile);
|
||||||
|
|
||||||
// Water, Lava and Redstone simulators get registered in their initialize function.
|
// Water, Lava and Redstone simulators get registered in their initialize function.
|
||||||
@ -2680,7 +2680,7 @@ void cWorld::UnloadUnusedChunks(void)
|
|||||||
|
|
||||||
void cWorld::QueueUnloadUnusedChunks(void)
|
void cWorld::QueueUnloadUnusedChunks(void)
|
||||||
{
|
{
|
||||||
QueueTask(make_unique<cWorld::cTaskUnloadUnusedChunks>());
|
QueueTask(cpp14::make_unique<cWorld::cTaskUnloadUnusedChunks>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
|
|||||||
|
|
||||||
int slots = slotsArg.getValue();
|
int slots = slotsArg.getValue();
|
||||||
|
|
||||||
auto repo = make_unique<cMemorySettingsRepository>();
|
auto repo = cpp14::make_unique<cMemorySettingsRepository>();
|
||||||
|
|
||||||
repo->SetValueI("Server", "MaxPlayers", slots);
|
repo->SetValueI("Server", "MaxPlayers", slots);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user