Replaced MakeUnique and MakeUniqueArray with std::make_unique

dev
Tomasz Kapuściński 2022-02-26 18:48:51 +01:00
parent 89551c83cf
commit 8533be8d5c
76 changed files with 392 additions and 538 deletions

View File

@ -49,7 +49,6 @@ add_library(colobotbase STATIC
common/language.h common/language.h
common/logger.cpp common/logger.cpp
common/logger.h common/logger.h
common/make_unique.h
common/profiler.cpp common/profiler.cpp
common/profiler.h common/profiler.h
common/regex_utils.cpp common/regex_utils.cpp

View File

@ -28,7 +28,6 @@
#include "common/image.h" #include "common/image.h"
#include "common/key.h" #include "common/key.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/profiler.h" #include "common/profiler.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "common/version.h" #include "common/version.h"
@ -111,11 +110,11 @@ struct ApplicationPrivate
CApplication::CApplication(CSystemUtils* systemUtils) CApplication::CApplication(CSystemUtils* systemUtils)
: m_systemUtils(systemUtils), : m_systemUtils(systemUtils),
m_private(MakeUnique<ApplicationPrivate>()), m_private(std::make_unique<ApplicationPrivate>()),
m_configFile(MakeUnique<CConfigFile>()), m_configFile(std::make_unique<CConfigFile>()),
m_input(MakeUnique<CInput>()), m_input(std::make_unique<CInput>()),
m_pathManager(MakeUnique<CPathManager>(systemUtils)), m_pathManager(std::make_unique<CPathManager>(systemUtils)),
m_modManager(MakeUnique<CModManager>(this, m_pathManager.get())) m_modManager(std::make_unique<CModManager>(this, m_pathManager.get()))
{ {
m_exitCode = 0; m_exitCode = 0;
m_active = false; m_active = false;
@ -514,11 +513,11 @@ bool CApplication::Create()
#ifdef OPENAL_SOUND #ifdef OPENAL_SOUND
if (!m_headless) if (!m_headless)
{ {
m_sound = MakeUnique<CALSound>(); m_sound = std::make_unique<CALSound>();
} }
else else
{ {
m_sound = MakeUnique<CSoundInterface>(); m_sound = std::make_unique<CSoundInterface>();
} }
#else #else
GetLogger()->Info("No sound support.\n"); GetLogger()->Info("No sound support.\n");
@ -536,7 +535,7 @@ bool CApplication::Create()
/* SDL initialization sequence */ /* SDL initialization sequence */
// Creating the m_engine now because it holds the vsync flag // Creating the m_engine now because it holds the vsync flag
m_engine = MakeUnique<Gfx::CEngine>(this, m_systemUtils); m_engine = std::make_unique<Gfx::CEngine>(this, m_systemUtils);
Uint32 initFlags = SDL_INIT_VIDEO | SDL_INIT_TIMER; Uint32 initFlags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
@ -689,10 +688,10 @@ bool CApplication::Create()
return false; return false;
} }
m_eventQueue = MakeUnique<CEventQueue>(); m_eventQueue = std::make_unique<CEventQueue>();
// Create the robot application. // Create the robot application.
m_controller = MakeUnique<CController>(); m_controller = std::make_unique<CController>();
StartLoadingMusic(); StartLoadingMusic();
@ -1247,7 +1246,7 @@ Event CApplication::ProcessSystemEvent()
else else
event.type = EVENT_KEY_UP; event.type = EVENT_KEY_UP;
auto data = MakeUnique<KeyEventData>(); auto data = std::make_unique<KeyEventData>();
data->virt = false; data->virt = false;
data->key = m_private->currentEvent.key.keysym.sym; data->key = m_private->currentEvent.key.keysym.sym;
@ -1270,7 +1269,7 @@ Event CApplication::ProcessSystemEvent()
else if (m_private->currentEvent.type == SDL_TEXTINPUT) else if (m_private->currentEvent.type == SDL_TEXTINPUT)
{ {
event.type = EVENT_TEXT_INPUT; event.type = EVENT_TEXT_INPUT;
auto data = MakeUnique<TextInputData>(); auto data = std::make_unique<TextInputData>();
data->text = m_private->currentEvent.text.text; data->text = m_private->currentEvent.text.text;
event.data = std::move(data); event.data = std::move(data);
} }
@ -1278,7 +1277,7 @@ Event CApplication::ProcessSystemEvent()
{ {
event.type = EVENT_MOUSE_WHEEL; event.type = EVENT_MOUSE_WHEEL;
auto data = MakeUnique<MouseWheelEventData>(); auto data = std::make_unique<MouseWheelEventData>();
data->y = m_private->currentEvent.wheel.y; data->y = m_private->currentEvent.wheel.y;
data->x = m_private->currentEvent.wheel.x; data->x = m_private->currentEvent.wheel.x;
@ -1287,7 +1286,7 @@ Event CApplication::ProcessSystemEvent()
else if ( (m_private->currentEvent.type == SDL_MOUSEBUTTONDOWN) || else if ( (m_private->currentEvent.type == SDL_MOUSEBUTTONDOWN) ||
(m_private->currentEvent.type == SDL_MOUSEBUTTONUP) ) (m_private->currentEvent.type == SDL_MOUSEBUTTONUP) )
{ {
auto data = MakeUnique<MouseButtonEventData>(); auto data = std::make_unique<MouseButtonEventData>();
if (m_private->currentEvent.type == SDL_MOUSEBUTTONDOWN) if (m_private->currentEvent.type == SDL_MOUSEBUTTONDOWN)
event.type = EVENT_MOUSE_BUTTON_DOWN; event.type = EVENT_MOUSE_BUTTON_DOWN;
@ -1308,7 +1307,7 @@ Event CApplication::ProcessSystemEvent()
{ {
event.type = EVENT_JOY_AXIS; event.type = EVENT_JOY_AXIS;
auto data = MakeUnique<JoyAxisEventData>(); auto data = std::make_unique<JoyAxisEventData>();
data->axis = m_private->currentEvent.jaxis.axis; data->axis = m_private->currentEvent.jaxis.axis;
data->value = m_private->currentEvent.jaxis.value; data->value = m_private->currentEvent.jaxis.value;
event.data = std::move(data); event.data = std::move(data);
@ -1321,7 +1320,7 @@ Event CApplication::ProcessSystemEvent()
else else
event.type = EVENT_JOY_BUTTON_UP; event.type = EVENT_JOY_BUTTON_UP;
auto data = MakeUnique<JoyButtonEventData>(); auto data = std::make_unique<JoyButtonEventData>();
data->button = m_private->currentEvent.jbutton.button; data->button = m_private->currentEvent.jbutton.button;
event.data = std::move(data); event.data = std::move(data);
} }
@ -1449,7 +1448,7 @@ Event CApplication::CreateVirtualEvent(const Event& sourceEvent)
auto sourceData = sourceEvent.GetData<JoyButtonEventData>(); auto sourceData = sourceEvent.GetData<JoyButtonEventData>();
auto data = MakeUnique<KeyEventData>(); auto data = std::make_unique<KeyEventData>();
data->virt = true; data->virt = true;
data->key = VIRTUAL_JOY(sourceData->button); data->key = VIRTUAL_JOY(sourceData->button);
virtualEvent.data = std::move(data); virtualEvent.data = std::move(data);

View File

@ -19,16 +19,13 @@
#include "app/controller.h" #include "app/controller.h"
#include "common/make_unique.h"
#include "level/robotmain.h" #include "level/robotmain.h"
CController::CController() CController::CController()
{ {
m_main = MakeUnique<CRobotMain>(); m_main = std::make_unique<CRobotMain>();
} }
CController::~CController() CController::~CController()

View File

@ -28,7 +28,6 @@
#include "app/signal_handlers.h" #include "app/signal_handlers.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/profiler.h" #include "common/profiler.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/version.h" #include "common/version.h"
@ -150,7 +149,7 @@ int main(int argc, char *argv[])
windowsArgs.push_back(std::move(argVec)); windowsArgs.push_back(std::move(argVec));
} }
auto windowsArgvPtrs = MakeUniqueArray<char*>(wargc); auto windowsArgvPtrs = std::make_unique<char*[]>(wargc);
for (int i = 0; i < wargc; i++) for (int i = 0; i < wargc; i++)
windowsArgvPtrs[i] = windowsArgs[i].data(); windowsArgvPtrs[i] = windowsArgs[i].data();

View File

@ -65,7 +65,7 @@ CPauseManager::~CPauseManager()
ActivePause* CPauseManager::ActivatePause(PauseType type, PauseMusic music) ActivePause* CPauseManager::ActivatePause(PauseType type, PauseMusic music)
{ {
GetLogger()->Debug("Activated pause mode - %s\n", GetPauseName(type).c_str()); GetLogger()->Debug("Activated pause mode - %s\n", GetPauseName(type).c_str());
auto pause = MakeUnique<ActivePause>(type, music); auto pause = std::make_unique<ActivePause>(type, music);
ActivePause* ptr = pause.get(); ActivePause* ptr = pause.get();
m_activePause.push_back(std::move(pause)); m_activePause.push_back(std::move(pause));
Update(); Update();

View File

@ -23,8 +23,6 @@
*/ */
#pragma once #pragma once
#include "common/make_unique.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include <memory> #include <memory>

View File

@ -21,7 +21,6 @@
#include "common/config_file.h" #include "common/config_file.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/resources/inputstream.h" #include "common/resources/inputstream.h"
#include "common/resources/outputstream.h" #include "common/resources/outputstream.h"
@ -66,13 +65,13 @@ bool CConfigFile::Init()
bool good; bool good;
if (m_useCurrentDirectory) if (m_useCurrentDirectory)
{ {
auto inputStream = MakeUnique<std::ifstream>("./colobot.ini"); auto inputStream = std::make_unique<std::ifstream>("./colobot.ini");
good = inputStream->good(); good = inputStream->good();
stream = std::move(inputStream); stream = std::move(inputStream);
} }
else else
{ {
auto inputStream = MakeUnique<CInputStream>("colobot.ini"); auto inputStream = std::make_unique<CInputStream>("colobot.ini");
good = inputStream->is_open(); good = inputStream->is_open();
stream = std::move(inputStream); stream = std::move(inputStream);
} }
@ -106,13 +105,13 @@ bool CConfigFile::Save()
bool good; bool good;
if (m_useCurrentDirectory) if (m_useCurrentDirectory)
{ {
auto outputStream = MakeUnique<std::ofstream>("./colobot.ini"); auto outputStream = std::make_unique<std::ofstream>("./colobot.ini");
good = outputStream->good(); good = outputStream->good();
stream = std::move(outputStream); stream = std::move(outputStream);
} }
else else
{ {
auto outputStream = MakeUnique<COutputStream>("colobot.ini"); auto outputStream = std::make_unique<COutputStream>("colobot.ini");
good = outputStream->is_open(); good = outputStream->is_open();
stream = std::move(outputStream); stream = std::move(outputStream);
} }

View File

@ -25,7 +25,6 @@
#pragma once #pragma once
#include "common/key.h" #include "common/key.h"
#include "common/make_unique.h"
#include <glm/glm.hpp> #include <glm/glm.hpp>
@ -663,7 +662,7 @@ struct KeyEventData : public EventData
{ {
std::unique_ptr<EventData> Clone() const override std::unique_ptr<EventData> Clone() const override
{ {
return MakeUnique<KeyEventData>(*this); return std::make_unique<KeyEventData>(*this);
} }
//! If true, the key is a virtual code generated by certain key modifiers or joystick buttons //! If true, the key is a virtual code generated by certain key modifiers or joystick buttons
@ -682,7 +681,7 @@ struct KeyEventData : public EventData
{ {
std::unique_ptr<EventData> Clone() const override std::unique_ptr<EventData> Clone() const override
{ {
return MakeUnique<TextInputData>(*this); return std::make_unique<TextInputData>(*this);
} }
//! Text entered by the user (usually one character, UTF-8 encoded) //! Text entered by the user (usually one character, UTF-8 encoded)
@ -712,7 +711,7 @@ struct MouseButtonEventData : public EventData
{ {
std::unique_ptr<EventData> Clone() const override std::unique_ptr<EventData> Clone() const override
{ {
return MakeUnique<MouseButtonEventData>(*this); return std::make_unique<MouseButtonEventData>(*this);
} }
//! The mouse button //! The mouse button
@ -727,7 +726,7 @@ struct MouseWheelEventData : public EventData
{ {
std::unique_ptr<EventData> Clone() const override std::unique_ptr<EventData> Clone() const override
{ {
return MakeUnique<MouseWheelEventData>(*this); return std::make_unique<MouseWheelEventData>(*this);
} }
//! Amount scrolled vertically, positive value is away from the user //! Amount scrolled vertically, positive value is away from the user
@ -744,7 +743,7 @@ struct JoyAxisEventData : public EventData
{ {
std::unique_ptr<EventData> Clone() const override std::unique_ptr<EventData> Clone() const override
{ {
return MakeUnique<JoyAxisEventData>(*this); return std::make_unique<JoyAxisEventData>(*this);
} }
//! The joystick axis index //! The joystick axis index
@ -761,7 +760,7 @@ struct JoyButtonEventData : public EventData
{ {
std::unique_ptr<EventData> Clone() const override std::unique_ptr<EventData> Clone() const override
{ {
return MakeUnique<JoyButtonEventData>(*this); return std::make_unique<JoyButtonEventData>(*this);
} }
//! The joystick button index //! The joystick button index

View File

@ -20,7 +20,6 @@
#include "common/font_loader.h" #include "common/font_loader.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/resources/inputstream.h" #include "common/resources/inputstream.h"
#include "common/resources/outputstream.h" #include "common/resources/outputstream.h"
@ -52,7 +51,7 @@ bool CFontLoader::Init()
try try
{ {
std::unique_ptr<std::istream> stream; std::unique_ptr<std::istream> stream;
auto inputStream = MakeUnique<CInputStream>("/fonts/fonts.ini"); auto inputStream = std::make_unique<CInputStream>("/fonts/fonts.ini");
bool good = inputStream->is_open(); bool good = inputStream->is_open();
stream = std::move(inputStream); stream = std::move(inputStream);

View File

@ -20,8 +20,6 @@
#include "common/image.h" #include "common/image.h"
#include "common/make_unique.h"
#include "common/resources/outputstream.h" #include "common/resources/outputstream.h"
#include "common/resources/resourcemanager.h" #include "common/resources/resourcemanager.h"
@ -147,7 +145,7 @@ bool PNGSaveSurface(const char *filename, SDL_Surface *surf)
png_write_info(pngPtr, infoPtr); png_write_info(pngPtr, infoPtr);
png_set_packing(pngPtr); png_set_packing(pngPtr);
auto rowPointers = MakeUniqueArray<png_bytep>(surf->h); auto rowPointers = std::make_unique<png_bytep[]>(surf->h);
for (int i = 0; i < surf->h; i++) for (int i = 0; i < surf->h; i++)
rowPointers[i] = static_cast<png_bytep>( static_cast<Uint8 *>(surf->pixels) ) + i*surf->pitch; rowPointers[i] = static_cast<png_bytep>( static_cast<Uint8 *>(surf->pixels) ) + i*surf->pitch;
png_write_image(pngPtr, rowPointers.get()); png_write_image(pngPtr, rowPointers.get());
@ -171,7 +169,7 @@ CImage::CImage()
CImage::CImage(const glm::ivec2& size) CImage::CImage(const glm::ivec2& size)
{ {
m_data = MakeUnique<ImageData>(); m_data = std::make_unique<ImageData>();
m_data->surface = SDL_CreateRGBSurface(0, size.x, size.y, 32, m_data->surface = SDL_CreateRGBSurface(0, size.x, size.y, 32,
0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
} }
@ -395,7 +393,7 @@ bool CImage::Load(const std::string& fileName)
if (! IsEmpty() ) if (! IsEmpty() )
Free(); Free();
m_data = MakeUnique<ImageData>(); m_data = std::make_unique<ImageData>();
m_error = ""; m_error = "";

View File

@ -1,48 +0,0 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2021, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://gnu.org/licenses
*/
#pragma once
#include <cstddef>
#include <memory>
/**
* A template function to make std::unique_ptr without naked new
* It can be replaced with std::make_unique once we use C++14
*/
template<typename T, typename... Args>
inline std::unique_ptr<T> MakeUnique(Args&&... args)
{
//@colobot-lint-exclude NakedNewRule
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
//@end-colobot-lint-exclude
}
/**
* A template function to make std::unique_ptr of array type without naked new
* It can be replaced with std::make_unique once we use C++14
*/
template<typename T>
inline std::unique_ptr<T[]> MakeUniqueArray(std::size_t size)
{
//@colobot-lint-exclude NakedNewRule
return std::unique_ptr<T[]>(new T[size]());
//@end-colobot-lint-exclude
}

View File

@ -19,8 +19,6 @@
#include "common/resources/inputstreambuffer.h" #include "common/resources/inputstreambuffer.h"
#include "common/make_unique.h"
#include "common/resources/resourcemanager.h" #include "common/resources/resourcemanager.h"
#include <stdexcept> #include <stdexcept>
@ -35,7 +33,7 @@ CInputStreamBuffer::CInputStreamBuffer(std::size_t bufferSize)
throw std::runtime_error("File buffer must be larger than 0 bytes"); throw std::runtime_error("File buffer must be larger than 0 bytes");
} }
m_buffer = MakeUniqueArray<char>(bufferSize); m_buffer = std::make_unique<char[]>(bufferSize);
} }

View File

@ -19,8 +19,6 @@
#include "common/resources/outputstreambuffer.h" #include "common/resources/outputstreambuffer.h"
#include "common/make_unique.h"
#include "common/resources/resourcemanager.h" #include "common/resources/resourcemanager.h"
#include <stdexcept> #include <stdexcept>
@ -34,7 +32,7 @@ COutputStreamBuffer::COutputStreamBuffer(std::size_t bufferSize)
throw std::runtime_error("File buffer must be larger then 0 bytes"); throw std::runtime_error("File buffer must be larger then 0 bytes");
} }
m_buffer = MakeUniqueArray<char>(bufferSize); m_buffer = std::make_unique<char[]>(bufferSize);
setp(m_buffer.get(), m_buffer.get() + bufferSize); setp(m_buffer.get(), m_buffer.get() + bufferSize);
} }

View File

@ -27,7 +27,6 @@
#endif #endif
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include <physfs.h> #include <physfs.h>
@ -124,17 +123,17 @@ std::string CResourceManager::GetSaveLocation()
std::unique_ptr<CSDLFileWrapper> CResourceManager::GetSDLFileHandler(const std::string &filename) std::unique_ptr<CSDLFileWrapper> CResourceManager::GetSDLFileHandler(const std::string &filename)
{ {
return MakeUnique<CSDLFileWrapper>(CleanPath(filename)); return std::make_unique<CSDLFileWrapper>(CleanPath(filename));
} }
std::unique_ptr<CSDLMemoryWrapper> CResourceManager::GetSDLMemoryHandler(const std::string &filename) std::unique_ptr<CSDLMemoryWrapper> CResourceManager::GetSDLMemoryHandler(const std::string &filename)
{ {
return MakeUnique<CSDLMemoryWrapper>(CleanPath(filename)); return std::make_unique<CSDLMemoryWrapper>(CleanPath(filename));
} }
std::unique_ptr<CSNDFileWrapper> CResourceManager::GetSNDFileHandler(const std::string &filename) std::unique_ptr<CSNDFileWrapper> CResourceManager::GetSNDFileHandler(const std::string &filename)
{ {
return MakeUnique<CSNDFileWrapper>(CleanPath(filename)); return std::make_unique<CSNDFileWrapper>(CleanPath(filename));
} }

View File

@ -21,7 +21,6 @@
#include "common/resources/sdl_memory_wrapper.h" #include "common/resources/sdl_memory_wrapper.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include <physfs.h> #include <physfs.h>
@ -45,7 +44,7 @@ CSDLMemoryWrapper::CSDLMemoryWrapper(const std::string& filename)
} }
PHYSFS_sint64 length = PHYSFS_fileLength(file); PHYSFS_sint64 length = PHYSFS_fileLength(file);
m_buffer = MakeUniqueArray<char>(length); m_buffer = std::make_unique<char[]>(length);
if (PHYSFS_read(file, m_buffer.get(), 1, length) != length) if (PHYSFS_read(file, m_buffer.get(), 1, length) != length)
{ {
GetLogger()->Error("Unable to read data for \"%s\"\n", filename.c_str()); GetLogger()->Error("Unable to read data for \"%s\"\n", filename.c_str());

View File

@ -20,8 +20,6 @@
#include "common/system/system.h" #include "common/system/system.h"
#include "common/make_unique.h"
#if defined(PLATFORM_WINDOWS) #if defined(PLATFORM_WINDOWS)
#include "common/system/system_windows.h" #include "common/system/system_windows.h"
#elif defined(PLATFORM_LINUX) #elif defined(PLATFORM_LINUX)
@ -43,13 +41,13 @@ std::unique_ptr<CSystemUtils> CSystemUtils::Create()
{ {
std::unique_ptr<CSystemUtils> instance; std::unique_ptr<CSystemUtils> instance;
#if defined(PLATFORM_WINDOWS) #if defined(PLATFORM_WINDOWS)
instance = MakeUnique<CSystemUtilsWindows>(); instance = std::make_unique<CSystemUtilsWindows>();
#elif defined(PLATFORM_LINUX) #elif defined(PLATFORM_LINUX)
instance = MakeUnique<CSystemUtilsLinux>(); instance = std::make_unique<CSystemUtilsLinux>();
#elif defined(PLATFORM_MACOSX) #elif defined(PLATFORM_MACOSX)
instance = MakeUnique<CSystemUtilsMacOSX>(); instance = std::make_unique<CSystemUtilsMacOSX>();
#else #else
instance = MakeUnique<CSystemUtilsOther>(); instance = std::make_unique<CSystemUtilsOther>();
#endif #endif
return instance; return instance;
} }

View File

@ -19,8 +19,6 @@
#pragma once #pragma once
#include "common/make_unique.h"
#include <condition_variable> #include <condition_variable>
#include <functional> #include <functional>
#include <mutex> #include <mutex>

View File

@ -26,7 +26,6 @@
#include "common/image.h" #include "common/image.h"
#include "common/key.h" #include "common/key.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/profiler.h" #include "common/profiler.h"
#include "common/stringutils.h" #include "common/stringutils.h"
@ -375,15 +374,15 @@ bool CEngine::Create()
SetMultiSample(m_multisample); SetMultiSample(m_multisample);
SetVSync(m_vsync); SetVSync(m_vsync);
m_modelManager = MakeUnique<COldModelManager>(this); m_modelManager = std::make_unique<COldModelManager>(this);
m_pyroManager = MakeUnique<CPyroManager>(); m_pyroManager = std::make_unique<CPyroManager>();
m_lightMan = MakeUnique<CLightManager>(this); m_lightMan = std::make_unique<CLightManager>(this);
m_text = MakeUnique<CText>(this); m_text = std::make_unique<CText>(this);
m_particle = MakeUnique<CParticle>(this); m_particle = std::make_unique<CParticle>(this);
m_water = MakeUnique<CWater>(this); m_water = std::make_unique<CWater>(this);
m_cloud = MakeUnique<CCloud>(this); m_cloud = std::make_unique<CCloud>(this);
m_lightning = MakeUnique<CLightning>(this); m_lightning = std::make_unique<CLightning>(this);
m_planet = MakeUnique<CPlanet>(this); m_planet = std::make_unique<CPlanet>(this);
m_lightMan->SetDevice(m_device); m_lightMan->SetDevice(m_device);
m_particle->SetDevice(m_device); m_particle->SetDevice(m_device);
@ -544,8 +543,8 @@ void CEngine::FrameUpdate()
void CEngine::WriteScreenShot(const std::string& fileName) void CEngine::WriteScreenShot(const std::string& fileName)
{ {
auto data = MakeUnique<WriteScreenShotData>(); auto data = std::make_unique<WriteScreenShotData>();
data->img = MakeUnique<CImage>(glm::ivec2(m_size.x, m_size.y)); data->img = std::make_unique<CImage>(glm::ivec2(m_size.x, m_size.y));
auto pixels = m_device->GetFrameBufferPixels(); auto pixels = m_device->GetFrameBufferPixels();
data->img->SetDataPixels(pixels->GetPixelsData()); data->img->SetDataPixels(pixels->GetPixelsData());
@ -3040,7 +3039,7 @@ void CEngine::Capture3DScene()
// calculate 2nd mipmap // calculate 2nd mipmap
int newWidth = width / 4; int newWidth = width / 4;
int newHeight = height / 4; int newHeight = height / 4;
std::unique_ptr<unsigned char[]> mipmap = MakeUniqueArray<unsigned char>(4 * newWidth * newHeight); std::unique_ptr<unsigned char[]> mipmap = std::make_unique<unsigned char[]>(4 * newWidth * newHeight);
for (int x = 0; x < newWidth; x++) for (int x = 0; x < newWidth; x++)
{ {
@ -3069,7 +3068,7 @@ void CEngine::Capture3DScene()
} }
// calculate Gaussian blur // calculate Gaussian blur
std::unique_ptr<unsigned char[]> blured = MakeUniqueArray<unsigned char>(4 * newWidth * newHeight); std::unique_ptr<unsigned char[]> blured = std::make_unique<unsigned char[]>(4 * newWidth * newHeight);
float matrix[7][7] = float matrix[7][7] =
{ {

View File

@ -19,8 +19,6 @@
#include "graphics/engine/pyro_manager.h" #include "graphics/engine/pyro_manager.h"
#include "common/make_unique.h"
#include "graphics/engine/pyro.h" #include "graphics/engine/pyro.h"
namespace Gfx namespace Gfx
@ -35,7 +33,7 @@ CPyroManager::~CPyroManager()
void Gfx::CPyroManager::Create(PyroType type, CObject* obj, float force) void Gfx::CPyroManager::Create(PyroType type, CObject* obj, float force)
{ {
auto pyroUPtr = MakeUnique<CPyro>(); auto pyroUPtr = std::make_unique<CPyro>();
pyroUPtr->Create(type, obj, force); pyroUPtr->Create(type, obj, force);
m_pyros.insert(std::move(pyroUPtr)); m_pyros.insert(std::move(pyroUPtr));
} }

View File

@ -361,7 +361,7 @@ bool CTerrain::RandomizeRelief()
for(int i = 0; i < octaveCount; i++) for(int i = 0; i < octaveCount; i++)
{ {
int pxCount = static_cast<int>(pow(2, (i+1)*2)); int pxCount = static_cast<int>(pow(2, (i+1)*2));
octaves[i] = MakeUniqueArray<float>(pxCount); octaves[i] = std::make_unique<float[]>(pxCount);
for(int j = 0; j < pxCount; j++) for(int j = 0; j < pxCount; j++)
{ {
octaves[i][j] = Math::Rand(); octaves[i][j] = Math::Rand();

View File

@ -385,7 +385,7 @@ CText::CText(CEngine* engine)
m_fontsCache = std::make_unique<FontsCache>(); m_fontsCache = std::make_unique<FontsCache>();
m_quadBatch = MakeUnique<CQuadBatch>(*engine); m_quadBatch = std::make_unique<CQuadBatch>(*engine);
} }
CText::~CText() CText::~CText()

View File

@ -24,7 +24,6 @@
#include "common/config_file.h" #include "common/config_file.h"
#include "common/image.h" #include "common/image.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "graphics/core/light.h" #include "graphics/core/light.h"
#include "graphics/core/material.h" #include "graphics/core/material.h"
@ -206,7 +205,7 @@ bool CGL33Device::Create()
framebufferParams.height = m_config.size.y; framebufferParams.height = m_config.size.y;
framebufferParams.depth = m_config.depthSize; framebufferParams.depth = m_config.depthSize;
m_framebuffers["default"] = MakeUnique<CDefaultFramebuffer>(framebufferParams); m_framebuffers["default"] = std::make_unique<CDefaultFramebuffer>(framebufferParams);
GetLogger()->Info("CDevice created successfully\n"); GetLogger()->Info("CDevice created successfully\n");
@ -254,7 +253,7 @@ void CGL33Device::ConfigChanged(const DeviceConfig& newConfig)
framebufferParams.height = m_config.size.y; framebufferParams.height = m_config.size.y;
framebufferParams.depth = m_config.depthSize; framebufferParams.depth = m_config.depthSize;
m_framebuffers["default"] = MakeUnique<CDefaultFramebuffer>(framebufferParams); m_framebuffers["default"] = std::make_unique<CDefaultFramebuffer>(framebufferParams);
} }
void CGL33Device::BeginScene() void CGL33Device::BeginScene()
@ -644,7 +643,7 @@ CFramebuffer* CGL33Device::CreateFramebuffer(std::string name, const Framebuffer
return nullptr; return nullptr;
} }
auto framebuffer = MakeUnique<CGLFramebuffer>(params); auto framebuffer = std::make_unique<CGLFramebuffer>(params);
if (!framebuffer->Create()) return nullptr; if (!framebuffer->Create()) return nullptr;
CFramebuffer* framebufferPtr = framebuffer.get(); CFramebuffer* framebufferPtr = framebuffer.get();

View File

@ -21,7 +21,6 @@
#include "common/image.h" #include "common/image.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "graphics/opengl/gl33device.h" #include "graphics/opengl/gl33device.h"
@ -69,14 +68,14 @@ FramebufferSupport DetectFramebufferSupport()
std::unique_ptr<CDevice> CreateDevice(const DeviceConfig &config, const std::string& name) std::unique_ptr<CDevice> CreateDevice(const DeviceConfig &config, const std::string& name)
{ {
if (name == "default") return MakeUnique<CGL33Device>(config); if (name == "default") return std::make_unique<CGL33Device>(config);
else if (name == "opengl") return MakeUnique<CGL33Device>(config); else if (name == "opengl") return std::make_unique<CGL33Device>(config);
else if (name == "gl33") return MakeUnique<CGL33Device>(config); else if (name == "gl33") return std::make_unique<CGL33Device>(config);
else if (name == "auto") else if (name == "auto")
{ {
int version = GetOpenGLVersion(); int version = GetOpenGLVersion();
if (version >= 33) return MakeUnique<CGL33Device>(config); if (version >= 33) return std::make_unique<CGL33Device>(config);
} }
return nullptr; return nullptr;
@ -462,7 +461,7 @@ GLint CreateShader(GLint type, const std::vector<std::string>& sources)
GLint len; GLint len;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len); glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
auto message = MakeUniqueArray<GLchar>(len + 1); auto message = std::make_unique<GLchar[]>(len + 1);
glGetShaderInfoLog(shader, len + 1, nullptr, message.get()); glGetShaderInfoLog(shader, len + 1, nullptr, message.get());
GetLogger()->Error("Shader compilation error occurred!\n%s\n", message.get()); GetLogger()->Error("Shader compilation error occurred!\n%s\n", message.get());
@ -507,7 +506,7 @@ GLint LoadShader(GLint type, const char* filename)
GLint len; GLint len;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len); glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
auto message = MakeUniqueArray<GLchar>(len + 1); auto message = std::make_unique<GLchar[]>(len + 1);
glGetShaderInfoLog(shader, len + 1, nullptr, message.get()); glGetShaderInfoLog(shader, len + 1, nullptr, message.get());
GetLogger()->Error("Shader compilation error occurred!\n%s\n", message.get()); GetLogger()->Error("Shader compilation error occurred!\n%s\n", message.get());
@ -540,7 +539,7 @@ GLint LinkProgram(int count, const GLint* shaders)
GLint len; GLint len;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &len); glGetProgramiv(program, GL_INFO_LOG_LENGTH, &len);
auto message = MakeUniqueArray<GLchar>(len + 1); auto message = std::make_unique<GLchar[]>(len + 1);
glGetProgramInfoLog(program, len + 1, nullptr, message.get()); glGetProgramInfoLog(program, len + 1, nullptr, message.get());
GetLogger()->Error("Shader program linking error occurred!\n%s\n", message.get()); GetLogger()->Error("Shader program linking error occurred!\n%s\n", message.get());
@ -590,7 +589,7 @@ GLint LinkProgram(const std::vector<GLint>& shaders)
std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size) std::unique_ptr<CGLFrameBufferPixels> GetGLFrameBufferPixels(const glm::ivec2& size)
{ {
auto pixels = MakeUnique<CGLFrameBufferPixels>(4 * size.x * size.y); auto pixels = std::make_unique<CGLFrameBufferPixels>(4 * size.x * size.y);
glReadPixels(0, 0, size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels->GetPixelsData()); glReadPixels(0, 0, size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels->GetPixelsData());

View File

@ -22,8 +22,6 @@
// config.h must be included first // config.h must be included first
#include "common/config.h" #include "common/config.h"
#include "common/make_unique.h"
#include "graphics/core/device.h" #include "graphics/core/device.h"
#include <GL/glew.h> #include <GL/glew.h>
@ -117,7 +115,7 @@ class CGLFrameBufferPixels : public CFrameBufferPixels
{ {
public: public:
CGLFrameBufferPixels(std::size_t size) CGLFrameBufferPixels(std::size_t size)
: m_pixels(MakeUniqueArray<GLubyte>(size)) : m_pixels(std::make_unique<GLubyte[]>(size))
{} {}
void* GetPixelsData() override void* GetPixelsData() override

View File

@ -21,7 +21,6 @@
#include "app/app.h" #include "app/app.h"
#include "common/make_unique.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "common/resources/inputstream.h" #include "common/resources/inputstream.h"
@ -209,7 +208,7 @@ void CLevelParser::Load()
if (command.empty()) if (command.empty())
continue; continue;
auto parserLine = MakeUnique<CLevelParserLine>(lineNumber, command); auto parserLine = std::make_unique<CLevelParserLine>(lineNumber, command);
parserLine->SetLevel(this); parserLine->SetLevel(this);
if (command.length() > 2 && command[command.length() - 2] == '.') if (command.length() > 2 && command[command.length() - 2] == '.')
@ -281,7 +280,7 @@ void CLevelParser::Load()
std::string paramValue = line.substr(0, pos + 1); std::string paramValue = line.substr(0, pos + 1);
boost::algorithm::trim(paramValue); boost::algorithm::trim(paramValue);
parserLine->AddParam(paramName, MakeUnique<CLevelParserParam>(paramName, paramValue)); parserLine->AddParam(paramName, std::make_unique<CLevelParserParam>(paramName, paramValue));
if (pos == std::string::npos) if (pos == std::string::npos)
break; break;
@ -294,7 +293,7 @@ void CLevelParser::Load()
std::string cmd = parserLine->GetCommand().substr(1, std::string::npos); std::string cmd = parserLine->GetCommand().substr(1, std::string::npos);
if(cmd == "Include") if(cmd == "Include")
{ {
std::unique_ptr<CLevelParser> includeParser = MakeUnique<CLevelParser>(parserLine->GetParam("file")->AsPath("")); std::unique_ptr<CLevelParser> includeParser = std::make_unique<CLevelParser>(parserLine->GetParam("file")->AsPath(""));
includeParser->Load(); includeParser->Load();
for(CLevelParserLineUPtr& line : includeParser->m_lines) for(CLevelParserLineUPtr& line : includeParser->m_lines)
{ {

View File

@ -24,8 +24,6 @@
#pragma once #pragma once
#include "common/make_unique.h"
#include "level/level_category.h" #include "level/level_category.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -106,7 +104,7 @@ private:
inline std::string InjectLevelPathsForCurrentLevel(const std::string& path, const std::string& defaultDir = "") inline std::string InjectLevelPathsForCurrentLevel(const std::string& path, const std::string& defaultDir = "")
{ {
CRobotMain* main = CRobotMain::GetInstancePointer(); CRobotMain* main = CRobotMain::GetInstancePointer();
auto levelParser = MakeUnique<CLevelParser>(); auto levelParser = std::make_unique<CLevelParser>();
levelParser->SetLevelPaths(main->GetLevelCategory(), main->GetLevelChap(), main->GetLevelRank()); levelParser->SetLevelPaths(main->GetLevelCategory(), main->GetLevelChap(), main->GetLevelRank());
return levelParser->InjectLevelPaths(path, defaultDir); return levelParser->InjectLevelPaths(path, defaultDir);
} }

View File

@ -20,7 +20,6 @@
#include "level/parser/parserline.h" #include "level/parser/parserline.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "level/parser/parser.h" #include "level/parser/parser.h"
@ -82,7 +81,7 @@ CLevelParserParam* CLevelParserLine::GetParam(std::string name)
return it->second.get(); return it->second.get();
} }
auto paramUPtr = MakeUnique<CLevelParserParam>(name, true); auto paramUPtr = std::make_unique<CLevelParserParam>(name, true);
paramUPtr->SetLine(this); paramUPtr->SetLine(this);
CLevelParserParam* paramPtr = paramUPtr.get(); CLevelParserParam* paramPtr = paramUPtr.get();
m_params.insert(std::make_pair(name, std::move(paramUPtr))); m_params.insert(std::make_pair(name, std::move(paramUPtr)));

View File

@ -22,7 +22,6 @@
#include "app/app.h" #include "app/app.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "common/resources/resourcemanager.h" #include "common/resources/resourcemanager.h"
@ -67,28 +66,28 @@ CLevelParserParam::CLevelParserParam(bool value)
CLevelParserParam::CLevelParserParam(Gfx::Color value) CLevelParserParam::CLevelParserParam(Gfx::Color value)
{ {
m_array.push_back(MakeUnique<CLevelParserParam>(value.r)); m_array.push_back(std::make_unique<CLevelParserParam>(value.r));
m_array.push_back(MakeUnique<CLevelParserParam>(value.g)); m_array.push_back(std::make_unique<CLevelParserParam>(value.g));
m_array.push_back(MakeUnique<CLevelParserParam>(value.b)); m_array.push_back(std::make_unique<CLevelParserParam>(value.b));
m_array.push_back(MakeUnique<CLevelParserParam>(value.a)); m_array.push_back(std::make_unique<CLevelParserParam>(value.a));
LoadArray(); LoadArray();
} }
CLevelParserParam::CLevelParserParam(glm::vec2 value) CLevelParserParam::CLevelParserParam(glm::vec2 value)
{ {
m_array.push_back(MakeUnique<CLevelParserParam>(value.x)); m_array.push_back(std::make_unique<CLevelParserParam>(value.x));
m_array.push_back(MakeUnique<CLevelParserParam>(value.y)); m_array.push_back(std::make_unique<CLevelParserParam>(value.y));
LoadArray(); LoadArray();
} }
CLevelParserParam::CLevelParserParam(glm::vec3 value) CLevelParserParam::CLevelParserParam(glm::vec3 value)
{ {
m_array.push_back(MakeUnique<CLevelParserParam>(value.x)); m_array.push_back(std::make_unique<CLevelParserParam>(value.x));
if(value.y != 0.0f) if(value.y != 0.0f)
m_array.push_back(MakeUnique<CLevelParserParam>(value.y)); m_array.push_back(std::make_unique<CLevelParserParam>(value.y));
m_array.push_back(MakeUnique<CLevelParserParam>(value.z)); m_array.push_back(std::make_unique<CLevelParserParam>(value.z));
LoadArray(); LoadArray();
} }
@ -1116,7 +1115,7 @@ void CLevelParserParam::ParseArray()
{ {
boost::algorithm::trim(value); boost::algorithm::trim(value);
if (value.empty()) continue; if (value.empty()) continue;
auto param = MakeUnique<CLevelParserParam>(m_name + "[" + boost::lexical_cast<std::string>(i) + "]", value); auto param = std::make_unique<CLevelParserParam>(m_name + "[" + boost::lexical_cast<std::string>(i) + "]", value);
param->SetLine(m_line); param->SetLine(m_line);
m_array.push_back(std::move(param)); m_array.push_back(std::move(param));
i++; i++;

View File

@ -21,7 +21,6 @@
#include "common/config_file.h" #include "common/config_file.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/resources/inputstream.h" #include "common/resources/inputstream.h"
@ -436,15 +435,15 @@ void CPlayerProfile::SaveApperance()
CLevelParser apperanceParser(GetSaveFile("face.gam")); CLevelParser apperanceParser(GetSaveFile("face.gam"));
CLevelParserLineUPtr line; CLevelParserLineUPtr line;
line = MakeUnique<CLevelParserLine>("Head"); line = std::make_unique<CLevelParserLine>("Head");
line->AddParam("face", MakeUnique<CLevelParserParam>(m_apperance.face)); line->AddParam("face", std::make_unique<CLevelParserParam>(m_apperance.face));
line->AddParam("glasses", MakeUnique<CLevelParserParam>(m_apperance.glasses)); line->AddParam("glasses", std::make_unique<CLevelParserParam>(m_apperance.glasses));
line->AddParam("hair", MakeUnique<CLevelParserParam>(m_apperance.colorHair)); line->AddParam("hair", std::make_unique<CLevelParserParam>(m_apperance.colorHair));
apperanceParser.AddLine(std::move(line)); apperanceParser.AddLine(std::move(line));
line = MakeUnique<CLevelParserLine>("Body"); line = std::make_unique<CLevelParserLine>("Body");
line->AddParam("combi", MakeUnique<CLevelParserParam>(m_apperance.colorCombi)); line->AddParam("combi", std::make_unique<CLevelParserParam>(m_apperance.colorCombi));
line->AddParam("band", MakeUnique<CLevelParserParam>(m_apperance.colorBand)); line->AddParam("band", std::make_unique<CLevelParserParam>(m_apperance.colorBand));
apperanceParser.AddLine(std::move(line)); apperanceParser.AddLine(std::move(line));
apperanceParser.Save(); apperanceParser.Save();

View File

@ -28,7 +28,6 @@
#include "common/config_file.h" #include "common/config_file.h"
#include "common/event.h" #include "common/event.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/settings.h" #include "common/settings.h"
#include "common/stringutils.h" #include "common/stringutils.h"
@ -152,26 +151,26 @@ CRobotMain::CRobotMain()
m_planet = m_engine->GetPlanet(); m_planet = m_engine->GetPlanet();
m_input = CInput::GetInstancePointer(); m_input = CInput::GetInstancePointer();
m_modelManager = MakeUnique<Gfx::CModelManager>(); m_modelManager = std::make_unique<Gfx::CModelManager>();
m_settings = MakeUnique<CSettings>(); m_settings = std::make_unique<CSettings>();
m_pause = MakeUnique<CPauseManager>(); m_pause = std::make_unique<CPauseManager>();
m_interface = MakeUnique<Ui::CInterface>(); m_interface = std::make_unique<Ui::CInterface>();
m_terrain = MakeUnique<Gfx::CTerrain>(); m_terrain = std::make_unique<Gfx::CTerrain>();
m_camera = MakeUnique<Gfx::CCamera>(); m_camera = std::make_unique<Gfx::CCamera>();
m_displayText = MakeUnique<Ui::CDisplayText>(); m_displayText = std::make_unique<Ui::CDisplayText>();
m_movie = MakeUnique<CMainMovie>(); m_movie = std::make_unique<CMainMovie>();
m_ui = MakeUnique<Ui::CMainUserInterface>(); m_ui = std::make_unique<Ui::CMainUserInterface>();
m_short = MakeUnique<Ui::CMainShort>(); m_short = std::make_unique<Ui::CMainShort>();
m_map = MakeUnique<Ui::CMainMap>(); m_map = std::make_unique<Ui::CMainMap>();
m_objMan = MakeUnique<CObjectManager>( m_objMan = std::make_unique<CObjectManager>(
m_engine, m_engine,
m_terrain.get(), m_terrain.get(),
m_oldModelManager, m_oldModelManager,
m_modelManager.get(), m_modelManager.get(),
m_particle); m_particle);
m_debugMenu = MakeUnique<Ui::CDebugMenu>(this, m_engine, m_objMan.get(), m_sound); m_debugMenu = std::make_unique<Ui::CDebugMenu>(this, m_engine, m_objMan.get(), m_sound);
m_time = 0.0f; m_time = 0.0f;
m_gameTime = 0.0f; m_gameTime = 0.0f;
@ -1045,14 +1044,14 @@ bool CRobotMain::ProcessEvent(Event &event)
if (obj != nullptr) if (obj != nullptr)
{ {
CLevelParserLine line("CreateObject"); CLevelParserLine line("CreateObject");
line.AddParam("type", MakeUnique<CLevelParserParam>(obj->GetType())); line.AddParam("type", std::make_unique<CLevelParserParam>(obj->GetType()));
glm::vec3 pos = obj->GetPosition()/g_unit; glm::vec3 pos = obj->GetPosition()/g_unit;
pos.y = 0.0f; pos.y = 0.0f;
line.AddParam("pos", MakeUnique<CLevelParserParam>(pos)); line.AddParam("pos", std::make_unique<CLevelParserParam>(pos));
float dir = Math::NormAngle(obj->GetRotationY()) / Math::PI; float dir = Math::NormAngle(obj->GetRotationY()) / Math::PI;
line.AddParam("dir", MakeUnique<CLevelParserParam>(dir)); line.AddParam("dir", std::make_unique<CLevelParserParam>(dir));
std::stringstream ss; std::stringstream ss;
ss << line; ss << line;
@ -1608,7 +1607,7 @@ void CRobotMain::StartDisplayInfo(const std::string& filename, int index)
bool soluce = m_ui->GetSceneSoluce(); bool soluce = m_ui->GetSceneSoluce();
m_displayInfo = MakeUnique<Ui::CDisplayInfo>(); m_displayInfo = std::make_unique<Ui::CDisplayInfo>();
m_displayInfo->StartDisplayInfo(filename, index, soluce); m_displayInfo->StartDisplayInfo(filename, index, soluce);
m_displayInfo->SetPosition(0); m_displayInfo->SetPosition(0);
} }
@ -2980,7 +2979,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (line->GetCommand() == "AudioChange" && !resetObject) if (line->GetCommand() == "AudioChange" && !resetObject)
{ {
auto audioChange = MakeUnique<CAudioChangeCondition>(); auto audioChange = std::make_unique<CAudioChangeCondition>();
audioChange->Read(line.get()); audioChange->Read(line.get());
m_ui->GetLoadingScreen()->SetProgress(0.15f, RT_LOADING_MUSIC, audioChange->music); m_ui->GetLoadingScreen()->SetProgress(0.15f, RT_LOADING_MUSIC, audioChange->music);
m_sound->CacheMusic(audioChange->music); m_sound->CacheMusic(audioChange->music);
@ -3638,7 +3637,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (line->GetCommand() == "EndMissionTake" && !resetObject) if (line->GetCommand() == "EndMissionTake" && !resetObject)
{ {
auto endTake = MakeUnique<CSceneEndCondition>(); auto endTake = std::make_unique<CSceneEndCondition>();
endTake->Read(line.get()); endTake->Read(line.get());
if (endTake->immediat) if (endTake->immediat)
m_endTakeImmediat = true; m_endTakeImmediat = true;
@ -3677,7 +3676,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (line->GetParam("enable")->AsBool(false)) if (line->GetParam("enable")->AsBool(false))
{ {
// Create the scoreboard // Create the scoreboard
m_scoreboard = MakeUnique<CScoreboard>(); m_scoreboard = std::make_unique<CScoreboard>();
m_scoreboard->SetSortType(line->GetParam("sort")->AsSortType(CScoreboard::SortType::SORT_ID)); m_scoreboard->SetSortType(line->GetParam("sort")->AsSortType(CScoreboard::SortType::SORT_ID));
} }
continue; continue;
@ -3687,7 +3686,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
{ {
if (!m_scoreboard) if (!m_scoreboard)
throw CLevelParserException("ScoreboardKillRule encountered but scoreboard is not enabled"); throw CLevelParserException("ScoreboardKillRule encountered but scoreboard is not enabled");
auto rule = MakeUnique<CScoreboard::CScoreboardKillRule>(); auto rule = std::make_unique<CScoreboard::CScoreboardKillRule>();
rule->Read(line.get()); rule->Read(line.get());
m_scoreboard->AddKillRule(std::move(rule)); m_scoreboard->AddKillRule(std::move(rule));
continue; continue;
@ -3696,7 +3695,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
{ {
if (!m_scoreboard) if (!m_scoreboard)
throw CLevelParserException("ScoreboardObjectRule encountered but scoreboard is not enabled"); throw CLevelParserException("ScoreboardObjectRule encountered but scoreboard is not enabled");
auto rule = MakeUnique<CScoreboard::CScoreboardObjectRule>(); auto rule = std::make_unique<CScoreboard::CScoreboardObjectRule>();
rule->Read(line.get()); rule->Read(line.get());
m_scoreboard->AddObjectRule(std::move(rule)); m_scoreboard->AddObjectRule(std::move(rule));
continue; continue;
@ -3705,7 +3704,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
{ {
if (!m_scoreboard) if (!m_scoreboard)
throw CLevelParserException("ScoreboardEndTakeRule encountered but scoreboard is not enabled"); throw CLevelParserException("ScoreboardEndTakeRule encountered but scoreboard is not enabled");
auto rule = MakeUnique<CScoreboard::CScoreboardEndTakeRule>(); auto rule = std::make_unique<CScoreboard::CScoreboardEndTakeRule>();
rule->Read(line.get()); rule->Read(line.get());
m_scoreboard->AddEndTakeRule(std::move(rule)); m_scoreboard->AddEndTakeRule(std::move(rule));
continue; continue;
@ -4619,29 +4618,29 @@ bool CRobotMain::IOIsBusy()
//! Writes an object into the backup file //! Writes an object into the backup file
void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj, const std::string& programDir, int objRank) void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj, const std::string& programDir, int objRank)
{ {
line->AddParam("type", MakeUnique<CLevelParserParam>(obj->GetType())); line->AddParam("type", std::make_unique<CLevelParserParam>(obj->GetType()));
line->AddParam("id", MakeUnique<CLevelParserParam>(obj->GetID())); line->AddParam("id", std::make_unique<CLevelParserParam>(obj->GetID()));
line->AddParam("pos", MakeUnique<CLevelParserParam>(obj->GetPosition()/g_unit)); line->AddParam("pos", std::make_unique<CLevelParserParam>(obj->GetPosition()/g_unit));
line->AddParam("angle", MakeUnique<CLevelParserParam>(obj->GetRotation() * Math::RAD_TO_DEG)); line->AddParam("angle", std::make_unique<CLevelParserParam>(obj->GetRotation() * Math::RAD_TO_DEG));
line->AddParam("zoom", MakeUnique<CLevelParserParam>(obj->GetScale())); line->AddParam("zoom", std::make_unique<CLevelParserParam>(obj->GetScale()));
if (obj->Implements(ObjectInterfaceType::Old)) if (obj->Implements(ObjectInterfaceType::Old))
{ {
line->AddParam("option", MakeUnique<CLevelParserParam>(obj->GetOption())); line->AddParam("option", std::make_unique<CLevelParserParam>(obj->GetOption()));
} }
if (obj->Implements(ObjectInterfaceType::Controllable)) if (obj->Implements(ObjectInterfaceType::Controllable))
{ {
auto controllableObj = dynamic_cast<CControllableObject*>(obj); auto controllableObj = dynamic_cast<CControllableObject*>(obj);
line->AddParam("trainer", MakeUnique<CLevelParserParam>(controllableObj->GetTrainer())); line->AddParam("trainer", std::make_unique<CLevelParserParam>(controllableObj->GetTrainer()));
if (controllableObj->GetSelect()) if (controllableObj->GetSelect())
line->AddParam("select", MakeUnique<CLevelParserParam>(true)); line->AddParam("select", std::make_unique<CLevelParserParam>(true));
} }
obj->Write(line); obj->Write(line);
if (obj->GetType() == OBJECT_BASE) if (obj->GetType() == OBJECT_BASE)
line->AddParam("run", MakeUnique<CLevelParserParam>(3)); // stops and open (PARAM_FIXSCENE) line->AddParam("run", std::make_unique<CLevelParserParam>(3)); // stops and open (PARAM_FIXSCENE)
if (obj->Implements(ObjectInterfaceType::ProgramStorage)) if (obj->Implements(ObjectInterfaceType::ProgramStorage))
@ -4665,7 +4664,7 @@ void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj, const std::
int run = dynamic_cast<CProgramStorageObject&>(*obj).GetProgramIndex(dynamic_cast<CProgrammableObject&>(*obj).GetCurrentProgram()); int run = dynamic_cast<CProgramStorageObject&>(*obj).GetProgramIndex(dynamic_cast<CProgrammableObject&>(*obj).GetCurrentProgram());
if (run != -1) if (run != -1)
{ {
line->AddParam("run", MakeUnique<CLevelParserParam>(run+1)); line->AddParam("run", std::make_unique<CLevelParserParam>(run+1));
} }
} }
} }
@ -4686,48 +4685,48 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s
CLevelParser levelParser(filename); CLevelParser levelParser(filename);
CLevelParserLineUPtr line; CLevelParserLineUPtr line;
line = MakeUnique<CLevelParserLine>("Title"); line = std::make_unique<CLevelParserLine>("Title");
line->AddParam("text", MakeUnique<CLevelParserParam>(std::string(info))); line->AddParam("text", std::make_unique<CLevelParserParam>(std::string(info)));
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
//TODO: Do we need that? It's not used anyway //TODO: Do we need that? It's not used anyway
line = MakeUnique<CLevelParserLine>("Version"); line = std::make_unique<CLevelParserLine>("Version");
line->AddParam("maj", MakeUnique<CLevelParserParam>(0)); line->AddParam("maj", std::make_unique<CLevelParserParam>(0));
line->AddParam("min", MakeUnique<CLevelParserParam>(1)); line->AddParam("min", std::make_unique<CLevelParserParam>(1));
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
line = MakeUnique<CLevelParserLine>("Created"); line = std::make_unique<CLevelParserLine>("Created");
line->AddParam("date", MakeUnique<CLevelParserParam>(static_cast<int>(time(nullptr)))); line->AddParam("date", std::make_unique<CLevelParserParam>(static_cast<int>(time(nullptr))));
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
line = MakeUnique<CLevelParserLine>("Mission"); line = std::make_unique<CLevelParserLine>("Mission");
line->AddParam("base", MakeUnique<CLevelParserParam>(GetLevelCategoryDir(m_levelCategory))); line->AddParam("base", std::make_unique<CLevelParserParam>(GetLevelCategoryDir(m_levelCategory)));
if (m_levelCategory == LevelCategory::CustomLevels) if (m_levelCategory == LevelCategory::CustomLevels)
line->AddParam("dir", MakeUnique<CLevelParserParam>(GetCustomLevelDir())); line->AddParam("dir", std::make_unique<CLevelParserParam>(GetCustomLevelDir()));
else else
line->AddParam("chap", MakeUnique<CLevelParserParam>(m_levelChap)); line->AddParam("chap", std::make_unique<CLevelParserParam>(m_levelChap));
line->AddParam("rank", MakeUnique<CLevelParserParam>(m_levelRank)); line->AddParam("rank", std::make_unique<CLevelParserParam>(m_levelRank));
line->AddParam("gametime", MakeUnique<CLevelParserParam>(GetGameTime())); line->AddParam("gametime", std::make_unique<CLevelParserParam>(GetGameTime()));
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
line = MakeUnique<CLevelParserLine>("Map"); line = std::make_unique<CLevelParserLine>("Map");
line->AddParam("zoom", MakeUnique<CLevelParserParam>(m_map->GetZoomMap())); line->AddParam("zoom", std::make_unique<CLevelParserParam>(m_map->GetZoomMap()));
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
line = MakeUnique<CLevelParserLine>("DoneResearch"); line = std::make_unique<CLevelParserLine>("DoneResearch");
line->AddParam("bits", MakeUnique<CLevelParserParam>(static_cast<int>(m_researchDone[0]))); line->AddParam("bits", std::make_unique<CLevelParserParam>(static_cast<int>(m_researchDone[0])));
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
float sleep, delay, magnetic, progress; float sleep, delay, magnetic, progress;
if (m_lightning->GetStatus(sleep, delay, magnetic, progress)) if (m_lightning->GetStatus(sleep, delay, magnetic, progress))
{ {
line = MakeUnique<CLevelParserLine>("BlitzMode"); line = std::make_unique<CLevelParserLine>("BlitzMode");
line->AddParam("sleep", MakeUnique<CLevelParserParam>(sleep)); line->AddParam("sleep", std::make_unique<CLevelParserParam>(sleep));
line->AddParam("delay", MakeUnique<CLevelParserParam>(delay)); line->AddParam("delay", std::make_unique<CLevelParserParam>(delay));
line->AddParam("magnetic", MakeUnique<CLevelParserParam>(magnetic/g_unit)); line->AddParam("magnetic", std::make_unique<CLevelParserParam>(magnetic/g_unit));
line->AddParam("progress", MakeUnique<CLevelParserParam>(progress)); line->AddParam("progress", std::make_unique<CLevelParserParam>(progress));
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
} }
@ -4747,19 +4746,19 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s
if (CObject *sub = slotted->GetSlotContainedObject(slot)) if (CObject *sub = slotted->GetSlotContainedObject(slot))
{ {
if (slot == slotted->MapPseudoSlot(CSlottedObject::Pseudoslot::POWER)) if (slot == slotted->MapPseudoSlot(CSlottedObject::Pseudoslot::POWER))
line = MakeUnique<CLevelParserLine>("CreatePower"); line = std::make_unique<CLevelParserLine>("CreatePower");
else if (slot == slotted->MapPseudoSlot(CSlottedObject::Pseudoslot::CARRYING)) else if (slot == slotted->MapPseudoSlot(CSlottedObject::Pseudoslot::CARRYING))
line = MakeUnique<CLevelParserLine>("CreateFret"); line = std::make_unique<CLevelParserLine>("CreateFret");
else else
line = MakeUnique<CLevelParserLine>("CreateSlotObject"); line = std::make_unique<CLevelParserLine>("CreateSlotObject");
line->AddParam("slotNum", MakeUnique<CLevelParserParam>(slot)); line->AddParam("slotNum", std::make_unique<CLevelParserParam>(slot));
IOWriteObject(line.get(), sub, dirname, objRank++); IOWriteObject(line.get(), sub, dirname, objRank++);
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
} }
} }
} }
line = MakeUnique<CLevelParserLine>("CreateObject"); line = std::make_unique<CLevelParserLine>("CreateObject");
IOWriteObject(line.get(), obj, dirname, objRank++); IOWriteObject(line.get(), obj, dirname, objRank++);
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
} }
@ -4958,7 +4957,7 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
// TODO: eww! // TODO: eww!
assert(obj->Implements(ObjectInterfaceType::Old)); assert(obj->Implements(ObjectInterfaceType::Old));
auto task = MakeUnique<CTaskManip>(dynamic_cast<COldObject*>(obj)); auto task = std::make_unique<CTaskManip>(dynamic_cast<COldObject*>(obj));
task->Start(TMO_AUTO, TMA_GRAB); // holds the object! task->Start(TMO_AUTO, TMA_GRAB); // holds the object!
} }
@ -5062,7 +5061,7 @@ void CRobotMain::SelectPlayer(std::string playerName)
{ {
assert(!playerName.empty()); assert(!playerName.empty());
m_playerProfile = MakeUnique<CPlayerProfile>(playerName); m_playerProfile = std::make_unique<CPlayerProfile>(playerName);
SetGlobalGamerName(playerName); SetGlobalGamerName(playerName);
} }

View File

@ -23,7 +23,6 @@
#include "app/app.h" #include "app/app.h"
#include "common/event.h" #include "common/event.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
@ -408,11 +407,11 @@ void CAuto::SetMotor(bool bMotor)
bool CAuto::Write(CLevelParserLine* line) bool CAuto::Write(CLevelParserLine* line)
{ {
line->AddParam("aType", MakeUnique<CLevelParserParam>(m_type)); line->AddParam("aType", std::make_unique<CLevelParserParam>(m_type));
line->AddParam("aBusy", MakeUnique<CLevelParserParam>(m_bBusy)); line->AddParam("aBusy", std::make_unique<CLevelParserParam>(m_bBusy));
line->AddParam("aTime", MakeUnique<CLevelParserParam>(m_time)); line->AddParam("aTime", std::make_unique<CLevelParserParam>(m_time));
line->AddParam("aProgressTime", MakeUnique<CLevelParserParam>(m_progressTime)); line->AddParam("aProgressTime", std::make_unique<CLevelParserParam>(m_progressTime));
line->AddParam("aProgressTotal", MakeUnique<CLevelParserParam>(m_progressTotal)); line->AddParam("aProgressTotal", std::make_unique<CLevelParserParam>(m_progressTotal));
return false; return false;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autoconvert.h" #include "object/auto/autoconvert.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -369,11 +367,11 @@ bool CAutoConvert::Write(CLevelParserLine* line)
if ( m_phase == ACP_STOP || if ( m_phase == ACP_STOP ||
m_phase == ACP_WAIT ) return false; m_phase == ACP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autoderrick.h" #include "object/auto/autoderrick.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
@ -435,11 +433,11 @@ bool CAutoDerrick::Write(CLevelParserLine* line)
{ {
if ( m_phase == ADP_WAIT ) return false; if ( m_phase == ADP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autodestroyer.h" #include "object/auto/autodestroyer.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/pyro_manager.h" #include "graphics/engine/pyro_manager.h"
@ -317,11 +315,11 @@ bool CAutoDestroyer::Write(CLevelParserLine* line)
{ {
if ( m_phase == ADEP_WAIT ) return false; if ( m_phase == ADEP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autoegg.h" #include "object/auto/autoegg.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/pyro_manager.h" #include "graphics/engine/pyro_manager.h"
@ -320,14 +318,14 @@ bool CAutoEgg::Write(CLevelParserLine* line)
{ {
if ( m_phase == AEP_NULL ) return false; if ( m_phase == AEP_NULL ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
line->AddParam("aParamType", MakeUnique<CLevelParserParam>(m_type)); line->AddParam("aParamType", std::make_unique<CLevelParserParam>(m_type));
line->AddParam("aParamValue1", MakeUnique<CLevelParserParam>(m_value)); line->AddParam("aParamValue1", std::make_unique<CLevelParserParam>(m_value));
line->AddParam("aParamString", MakeUnique<CLevelParserParam>(m_alienProgramName)); line->AddParam("aParamString", std::make_unique<CLevelParserParam>(m_alienProgramName));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autofactory.h" #include "object/auto/autofactory.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -534,11 +532,11 @@ bool CAutoFactory::Write(CLevelParserLine* line)
{ {
if ( m_phase == AFP_WAIT ) return false; if ( m_phase == AFP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autolabo.h" #include "object/auto/autolabo.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -584,12 +582,12 @@ bool CAutoLabo::Write(CLevelParserLine* line)
{ {
if ( m_phase == ALAP_WAIT ) return false; if ( m_phase == ALAP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
line->AddParam("aResearch", MakeUnique<CLevelParserParam>(static_cast<int>(m_research))); line->AddParam("aResearch", std::make_unique<CLevelParserParam>(static_cast<int>(m_research)));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/automush.h" #include "object/auto/automush.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/parser/parserline.h" #include "level/parser/parserline.h"
@ -308,11 +306,11 @@ bool CAutoMush::Write(CLevelParserLine* line)
{ {
if ( m_phase == AMP_WAIT ) return false; if ( m_phase == AMP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autonest.h" #include "object/auto/autonest.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
@ -213,11 +211,11 @@ bool CAutoNest::Write(CLevelParserLine* line)
{ {
if ( m_phase == ANP_WAIT ) return false; if ( m_phase == ANP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autonuclearplant.h" #include "object/auto/autonuclearplant.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -439,11 +437,11 @@ bool CAutoNuclearPlant::Write(CLevelParserLine* line)
if ( m_phase == ANUP_STOP || if ( m_phase == ANUP_STOP ||
m_phase == ANUP_WAIT ) return false; m_phase == ANUP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autopowercaptor.h" #include "object/auto/autopowercaptor.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/parser/parserline.h" #include "level/parser/parserline.h"
@ -295,11 +293,11 @@ bool CAutoPowerCaptor::Write(CLevelParserLine* line)
{ {
if ( m_phase == APAP_WAIT ) return false; if ( m_phase == APAP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autopowerplant.h" #include "object/auto/autopowerplant.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
@ -592,11 +590,11 @@ bool CAutoPowerPlant::Write(CLevelParserLine* line)
if ( m_phase == AENP_STOP || if ( m_phase == AENP_STOP ||
m_phase == AENP_WAIT ) return false; m_phase == AENP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autorepair.h" #include "object/auto/autorepair.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/parser/parserline.h" #include "level/parser/parserline.h"
@ -279,11 +277,11 @@ bool CAutoRepair::Write(CLevelParserLine* line)
{ {
if ( m_phase == ARP_WAIT ) return false; if ( m_phase == ARP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -21,7 +21,6 @@
#include "object/auto/autoresearch.h" #include "object/auto/autoresearch.h"
#include "common/global.h" #include "common/global.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
@ -569,12 +568,12 @@ bool CAutoResearch::Write(CLevelParserLine* line)
{ {
if ( m_phase == ALP_WAIT ) return false; if ( m_phase == ALP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
line->AddParam("aResearch", MakeUnique<CLevelParserParam>(static_cast<int>(m_research))); line->AddParam("aResearch", std::make_unique<CLevelParserParam>(static_cast<int>(m_research)));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autotower.h" #include "object/auto/autotower.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -467,16 +465,16 @@ bool CAutoTower::Write(CLevelParserLine* line)
{ {
if ( m_phase == ATP_WAIT ) return false; if ( m_phase == ATP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
line->AddParam("aTargetPos", MakeUnique<CLevelParserParam>(m_targetPos)); line->AddParam("aTargetPos", std::make_unique<CLevelParserParam>(m_targetPos));
line->AddParam("aAngleYactual", MakeUnique<CLevelParserParam>(m_angleYactual)); line->AddParam("aAngleYactual", std::make_unique<CLevelParserParam>(m_angleYactual));
line->AddParam("aAngleZactual", MakeUnique<CLevelParserParam>(m_angleZactual)); line->AddParam("aAngleZactual", std::make_unique<CLevelParserParam>(m_angleZactual));
line->AddParam("aAngleYfinal", MakeUnique<CLevelParserParam>(m_angleYfinal)); line->AddParam("aAngleYfinal", std::make_unique<CLevelParserParam>(m_angleYfinal));
line->AddParam("aAngleZfinal", MakeUnique<CLevelParserParam>(m_angleZfinal)); line->AddParam("aAngleZfinal", std::make_unique<CLevelParserParam>(m_angleZfinal));
return true; return true;
} }

View File

@ -20,8 +20,6 @@
#include "object/auto/autovault.h" #include "object/auto/autovault.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -359,11 +357,11 @@ bool CAutoVault::Write(CLevelParserLine* line)
{ {
if ( m_phase == ASAP_WAIT ) return false; if ( m_phase == ASAP_WAIT ) return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -101,8 +101,8 @@ bool CProgramStorageObjectImpl::GetActiveVirus()
Program* CProgramStorageObjectImpl::AddProgram() Program* CProgramStorageObjectImpl::AddProgram()
{ {
assert(m_object->Implements(ObjectInterfaceType::Old)); //TODO assert(m_object->Implements(ObjectInterfaceType::Old)); //TODO
auto program = MakeUnique<Program>(); auto program = std::make_unique<Program>();
program->script = MakeUnique<CScript>(dynamic_cast<COldObject*>(this)); program->script = std::make_unique<CScript>(dynamic_cast<COldObject*>(this));
Program* prog = program.get(); Program* prog = program.get();
AddProgram(std::move(program)); AddProgram(std::move(program));
@ -130,7 +130,7 @@ Program* CProgramStorageObjectImpl::CloneProgram(Program* program)
Program* newprog = AddProgram(); Program* newprog = AddProgram();
// TODO: Is there any reason CScript doesn't have a function to get the program code directly? // TODO: Is there any reason CScript doesn't have a function to get the program code directly?
auto edit = MakeUnique<Ui::CEdit>(); auto edit = std::make_unique<Ui::CEdit>();
program->script->PutScript(edit.get(), ""); program->script->PutScript(edit.get(), "");
newprog->script->GetScript(edit.get()); newprog->script->GetScript(edit.get());
@ -314,15 +314,15 @@ void CProgramStorageObjectImpl::LoadAllProgramsForLevel(CLevelParserLine* levelS
void CProgramStorageObjectImpl::SaveAllProgramsForSavedScene(CLevelParserLine* levelSourceLine, const std::string& levelSource) void CProgramStorageObjectImpl::SaveAllProgramsForSavedScene(CLevelParserLine* levelSourceLine, const std::string& levelSource)
{ {
levelSourceLine->AddParam("programStorageIndex", MakeUnique<CLevelParserParam>(m_programStorageIndex)); levelSourceLine->AddParam("programStorageIndex", std::make_unique<CLevelParserParam>(m_programStorageIndex));
for (unsigned int i = 0; i < m_program.size(); i++) for (unsigned int i = 0; i < m_program.size(); i++)
{ {
if (!m_program[i]->filename.empty() && m_program[i]->readOnly) if (!m_program[i]->filename.empty() && m_program[i]->readOnly)
{ {
levelSourceLine->AddParam("script" + StrUtils::ToString<int>(i+1), MakeUnique<CLevelParserParam>(m_program[i]->filename)); levelSourceLine->AddParam("script" + StrUtils::ToString<int>(i+1), std::make_unique<CLevelParserParam>(m_program[i]->filename));
levelSourceLine->AddParam("scriptReadOnly" + StrUtils::ToString<int>(i+1), MakeUnique<CLevelParserParam>(m_program[i]->readOnly)); levelSourceLine->AddParam("scriptReadOnly" + StrUtils::ToString<int>(i+1), std::make_unique<CLevelParserParam>(m_program[i]->readOnly));
levelSourceLine->AddParam("scriptRunnable" + StrUtils::ToString<int>(i+1), MakeUnique<CLevelParserParam>(m_program[i]->runnable)); levelSourceLine->AddParam("scriptRunnable" + StrUtils::ToString<int>(i+1), std::make_unique<CLevelParserParam>(m_program[i]->runnable));
} }
} }
@ -337,8 +337,8 @@ void CProgramStorageObjectImpl::SaveAllProgramsForSavedScene(CLevelParserLine* l
GetLogger()->Trace("Saving program '%s' to saved scene\n", filename.c_str()); GetLogger()->Trace("Saving program '%s' to saved scene\n", filename.c_str());
WriteProgram(m_program[i].get(), filename); WriteProgram(m_program[i].get(), filename);
levelSourceLine->AddParam("scriptReadOnly" + StrUtils::ToString<int>(i+1), MakeUnique<CLevelParserParam>(m_program[i]->readOnly)); levelSourceLine->AddParam("scriptReadOnly" + StrUtils::ToString<int>(i+1), std::make_unique<CLevelParserParam>(m_program[i]->readOnly));
levelSourceLine->AddParam("scriptRunnable" + StrUtils::ToString<int>(i+1), MakeUnique<CLevelParserParam>(m_program[i]->runnable)); levelSourceLine->AddParam("scriptRunnable" + StrUtils::ToString<int>(i+1), std::make_unique<CLevelParserParam>(m_program[i]->runnable));
} }
boost::regex regex(StrUtils::Format("prog%.3d([0-9]{3})\\.txt", m_programStorageIndex)); boost::regex regex(StrUtils::Format("prog%.3d([0-9]{3})\\.txt", m_programStorageIndex));

View File

@ -251,7 +251,7 @@ void CProgrammableObjectImpl::TraceRecordStart()
m_traceColor = TraceColor::Default; m_traceColor = TraceColor::Default;
} }
m_traceRecordBuffer = MakeUniqueArray<TraceRecord>(MAXTRACERECORD); m_traceRecordBuffer = std::make_unique<TraceRecord[]>(MAXTRACERECORD);
m_traceRecordIndex = 0; m_traceRecordIndex = 0;
} }

View File

@ -142,7 +142,7 @@ Error CTaskExecutorObjectImpl::StartForegroundTask(Args&&... args)
StopForegroundTask(); StopForegroundTask();
assert(m_object->Implements(ObjectInterfaceType::Old)); //TODO assert(m_object->Implements(ObjectInterfaceType::Old)); //TODO
std::unique_ptr<TaskType> task = MakeUnique<TaskType>(dynamic_cast<COldObject*>(m_object)); std::unique_ptr<TaskType> task = std::make_unique<TaskType>(dynamic_cast<COldObject*>(m_object));
Error err = task->Start(std::forward<Args>(args)...); Error err = task->Start(std::forward<Args>(args)...);
if (err == ERR_OK) if (err == ERR_OK)
m_foregroundTask = std::move(task); m_foregroundTask = std::move(task);
@ -168,7 +168,7 @@ Error CTaskExecutorObjectImpl::StartBackgroundTask(Args&&... args)
m_backgroundTask.reset(); // In case the old task was of a different type m_backgroundTask.reset(); // In case the old task was of a different type
assert(m_object->Implements(ObjectInterfaceType::Old)); //TODO assert(m_object->Implements(ObjectInterfaceType::Old)); //TODO
std::unique_ptr<TaskType> newTask = MakeUnique<TaskType>(dynamic_cast<COldObject*>(m_object)); std::unique_ptr<TaskType> newTask = std::make_unique<TaskType>(dynamic_cast<COldObject*>(m_object));
err = newTask->Start(std::forward<Args>(args)...); err = newTask->Start(std::forward<Args>(args)...);
if (err == ERR_OK) if (err == ERR_OK)
m_backgroundTask = std::move(newTask); m_backgroundTask = std::move(newTask);

View File

@ -22,8 +22,6 @@
#include "app/app.h" #include "app/app.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -164,9 +162,9 @@ bool CMotion::Write(CLevelParserLine* line)
{ {
if ( m_actionType == -1 ) return false; if ( m_actionType == -1 ) return false;
line->AddParam("mType", MakeUnique<CLevelParserParam>(m_actionType)); line->AddParam("mType", std::make_unique<CLevelParserParam>(m_actionType));
line->AddParam("mTime", MakeUnique<CLevelParserParam>(m_actionTime)); line->AddParam("mTime", std::make_unique<CLevelParserParam>(m_actionTime));
line->AddParam("mProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("mProgress", std::make_unique<CLevelParserParam>(m_progress));
return false; return false;
} }

View File

@ -19,8 +19,6 @@
#include "object/object_factory.h" #include "object/object_factory.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/lightning.h" #include "graphics/engine/lightning.h"
#include "graphics/engine/oldmodelmanager.h" #include "graphics/engine/oldmodelmanager.h"
@ -335,7 +333,7 @@ CObjectUPtr CObjectFactory::CreateResource(const ObjectCreateParams& params)
ObjectType type = params.type; ObjectType type = params.type;
float power = params.power; float power = params.power;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -450,7 +448,7 @@ CObjectUPtr CObjectFactory::CreateFlag(const ObjectCreateParams& params)
float angle = params.angle; float angle = params.angle;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -512,7 +510,7 @@ CObjectUPtr CObjectFactory::CreateBarrier(const ObjectCreateParams& params)
float height = params.height; float height = params.height;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -652,7 +650,7 @@ CObjectUPtr CObjectFactory::CreatePlant(const ObjectCreateParams& params)
float height = params.height; float height = params.height;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -894,7 +892,7 @@ CObjectUPtr CObjectFactory::CreateMushroom(const ObjectCreateParams& params)
float height = params.height; float height = params.height;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -954,7 +952,7 @@ CObjectUPtr CObjectFactory::CreateTeen(const ObjectCreateParams& params)
ObjectType type = params.type; ObjectType type = params.type;
int option = params.option; int option = params.option;
COldObjectUPtr obj = MakeUnique<COldObject>(params.id); COldObjectUPtr obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetOption(option); obj->SetOption(option);
@ -1741,7 +1739,7 @@ CObjectUPtr CObjectFactory::CreateQuartz(const ObjectCreateParams& params)
float height = params.height; float height = params.height;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -1848,7 +1846,7 @@ CObjectUPtr CObjectFactory::CreateRoot(const ObjectCreateParams& params)
float height = params.height; float height = params.height;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
@ -2015,7 +2013,7 @@ CObjectUPtr CObjectFactory::CreateHome(const ObjectCreateParams& params)
float height = params.height; float height = params.height;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -2056,7 +2054,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params)
float height = params.height; float height = params.height;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -2472,7 +2470,7 @@ CObjectUPtr CObjectFactory::CreateApollo(const ObjectCreateParams& params)
float angle = params.angle; float angle = params.angle;
ObjectType type = params.type; ObjectType type = params.type;
auto obj = MakeUnique<COldObject>(params.id); auto obj = std::make_unique<COldObject>(params.id);
obj->SetType(type); obj->SetType(type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -2588,15 +2586,15 @@ void CObjectFactory::AddObjectAuto(COldObject* obj)
if ( type == OBJECT_EGG ) if ( type == OBJECT_EGG )
{ {
objAuto = MakeUnique<CAutoEgg>(obj); objAuto = std::make_unique<CAutoEgg>(obj);
} }
if ( type == OBJECT_ROOT5 ) if ( type == OBJECT_ROOT5 )
{ {
objAuto = MakeUnique<CAutoRoot>(obj); objAuto = std::make_unique<CAutoRoot>(obj);
} }
if ( type == OBJECT_MUSHROOM2 ) if ( type == OBJECT_MUSHROOM2 )
{ {
objAuto = MakeUnique<CAutoMush>(obj); objAuto = std::make_unique<CAutoMush>(obj);
} }
if ( type == OBJECT_FLAGb || if ( type == OBJECT_FLAGb ||
type == OBJECT_FLAGr || type == OBJECT_FLAGr ||
@ -2604,13 +2602,13 @@ void CObjectFactory::AddObjectAuto(COldObject* obj)
type == OBJECT_FLAGy || type == OBJECT_FLAGy ||
type == OBJECT_FLAGv ) type == OBJECT_FLAGv )
{ {
objAuto = MakeUnique<CAutoFlag>(obj); objAuto = std::make_unique<CAutoFlag>(obj);
} }
if ( type == OBJECT_TEEN36 || // trunk? if ( type == OBJECT_TEEN36 || // trunk?
type == OBJECT_TEEN37 || // boat? type == OBJECT_TEEN37 || // boat?
type == OBJECT_TEEN38 ) // fan? type == OBJECT_TEEN38 ) // fan?
{ {
objAuto = MakeUnique<CAutoKid>(obj); objAuto = std::make_unique<CAutoKid>(obj);
} }
if (objAuto != nullptr) if (objAuto != nullptr)

View File

@ -20,7 +20,6 @@
#include "object/object_manager.h" #include "object/object_manager.h"
#include "common/global.h" #include "common/global.h"
#include "common/make_unique.h"
#include "math/all.h" #include "math/all.h"
@ -41,7 +40,7 @@ CObjectManager::CObjectManager(Gfx::CEngine* engine,
Gfx::COldModelManager* oldModelManager, Gfx::COldModelManager* oldModelManager,
Gfx::CModelManager* modelManager, Gfx::CModelManager* modelManager,
Gfx::CParticle* particle) Gfx::CParticle* particle)
: m_objectFactory(MakeUnique<CObjectFactory>(engine, : m_objectFactory(std::make_unique<CObjectFactory>(engine,
terrain, terrain,
oldModelManager, oldModelManager,
modelManager, modelManager,

View File

@ -23,7 +23,6 @@
#include "app/app.h" #include "app/app.h"
#include "common/global.h" #include "common/global.h"
#include "common/make_unique.h"
#include "common/settings.h" #include "common/settings.h"
#include "common/stringutils.h" #include "common/stringutils.h"
@ -1071,74 +1070,74 @@ void COldObject::Write(CLevelParserLine* line)
{ {
glm::vec3 pos; glm::vec3 pos;
line->AddParam("camera", MakeUnique<CLevelParserParam>(GetCameraType())); line->AddParam("camera", std::make_unique<CLevelParserParam>(GetCameraType()));
if ( GetCameraLock() ) if ( GetCameraLock() )
line->AddParam("cameraLock", MakeUnique<CLevelParserParam>(GetCameraLock())); line->AddParam("cameraLock", std::make_unique<CLevelParserParam>(GetCameraLock()));
if ( IsBulletWall() ) if ( IsBulletWall() )
line->AddParam("bulletWall", MakeUnique<CLevelParserParam>(IsBulletWall())); line->AddParam("bulletWall", std::make_unique<CLevelParserParam>(IsBulletWall()));
if ( GetEnergyLevel() != 0.0f ) if ( GetEnergyLevel() != 0.0f )
line->AddParam("energy", MakeUnique<CLevelParserParam>(GetEnergyLevel())); line->AddParam("energy", std::make_unique<CLevelParserParam>(GetEnergyLevel()));
if ( GetShield() != 1.0f ) if ( GetShield() != 1.0f )
line->AddParam("shield", MakeUnique<CLevelParserParam>(GetShield())); line->AddParam("shield", std::make_unique<CLevelParserParam>(GetShield()));
if ( GetRange() != 1.0f ) if ( GetRange() != 1.0f )
line->AddParam("range", MakeUnique<CLevelParserParam>(GetRange())); line->AddParam("range", std::make_unique<CLevelParserParam>(GetRange()));
if ( !GetSelectable() ) if ( !GetSelectable() )
line->AddParam("selectable", MakeUnique<CLevelParserParam>(GetSelectable())); line->AddParam("selectable", std::make_unique<CLevelParserParam>(GetSelectable()));
if ( !GetCollisions() ) if ( !GetCollisions() )
line->AddParam("clip", MakeUnique<CLevelParserParam>(GetCollisions())); line->AddParam("clip", std::make_unique<CLevelParserParam>(GetCollisions()));
if ( GetLock() ) if ( GetLock() )
line->AddParam("lock", MakeUnique<CLevelParserParam>(GetLock())); line->AddParam("lock", std::make_unique<CLevelParserParam>(GetLock()));
if ( !GetActivity() ) if ( !GetActivity() )
line->AddParam("activity", MakeUnique<CLevelParserParam>(GetActivity())); line->AddParam("activity", std::make_unique<CLevelParserParam>(GetActivity()));
if ( GetProxyActivate() ) if ( GetProxyActivate() )
{ {
line->AddParam("proxyActivate", MakeUnique<CLevelParserParam>(GetProxyActivate())); line->AddParam("proxyActivate", std::make_unique<CLevelParserParam>(GetProxyActivate()));
line->AddParam("proxyDistance", MakeUnique<CLevelParserParam>(GetProxyDistance()/g_unit)); line->AddParam("proxyDistance", std::make_unique<CLevelParserParam>(GetProxyDistance()/g_unit));
} }
if ( GetMagnifyDamage() != 1.0f ) if ( GetMagnifyDamage() != 1.0f )
line->AddParam("magnifyDamage", MakeUnique<CLevelParserParam>(GetMagnifyDamage())); line->AddParam("magnifyDamage", std::make_unique<CLevelParserParam>(GetMagnifyDamage()));
if ( GetTeam() != 0 ) if ( GetTeam() != 0 )
line->AddParam("team", MakeUnique<CLevelParserParam>(GetTeam())); line->AddParam("team", std::make_unique<CLevelParserParam>(GetTeam()));
if ( GetGunGoalV() != 0.0f ) if ( GetGunGoalV() != 0.0f )
line->AddParam("aimV", MakeUnique<CLevelParserParam>(GetGunGoalV())); line->AddParam("aimV", std::make_unique<CLevelParserParam>(GetGunGoalV()));
if ( GetGunGoalH() != 0.0f ) if ( GetGunGoalH() != 0.0f )
line->AddParam("aimH", MakeUnique<CLevelParserParam>(GetGunGoalH())); line->AddParam("aimH", std::make_unique<CLevelParserParam>(GetGunGoalH()));
if ( GetAnimateOnReset() ) if ( GetAnimateOnReset() )
{ {
line->AddParam("reset", MakeUnique<CLevelParserParam>(GetAnimateOnReset())); line->AddParam("reset", std::make_unique<CLevelParserParam>(GetAnimateOnReset()));
} }
if ( m_bVirusMode ) if ( m_bVirusMode )
line->AddParam("virusMode", MakeUnique<CLevelParserParam>(m_bVirusMode)); line->AddParam("virusMode", std::make_unique<CLevelParserParam>(m_bVirusMode));
if ( m_virusTime != 0.0f ) if ( m_virusTime != 0.0f )
line->AddParam("virusTime", MakeUnique<CLevelParserParam>(m_virusTime)); line->AddParam("virusTime", std::make_unique<CLevelParserParam>(m_virusTime));
line->AddParam("lifetime", MakeUnique<CLevelParserParam>(m_aTime)); line->AddParam("lifetime", std::make_unique<CLevelParserParam>(m_aTime));
// Sets the parameters of the command line. // Sets the parameters of the command line.
CLevelParserParamVec cmdline; CLevelParserParamVec cmdline;
for(float value : GetCmdLine()) for(float value : GetCmdLine())
{ {
cmdline.push_back(MakeUnique<CLevelParserParam>(value)); cmdline.push_back(std::make_unique<CLevelParserParam>(value));
} }
if (cmdline.size() > 0) if (cmdline.size() > 0)
line->AddParam("cmdline", MakeUnique<CLevelParserParam>(std::move(cmdline))); line->AddParam("cmdline", std::make_unique<CLevelParserParam>(std::move(cmdline)));
if ( m_motion != nullptr ) if ( m_motion != nullptr )
{ {
@ -1147,7 +1146,7 @@ void COldObject::Write(CLevelParserLine* line)
if ( Implements(ObjectInterfaceType::Programmable) ) if ( Implements(ObjectInterfaceType::Programmable) )
{ {
line->AddParam("bVirusActive", MakeUnique<CLevelParserParam>(GetActiveVirus())); line->AddParam("bVirusActive", std::make_unique<CLevelParserParam>(GetActiveVirus()));
} }
if ( m_physics != nullptr ) if ( m_physics != nullptr )
@ -2698,7 +2697,7 @@ bool COldObject::JostleObject(float force)
{ {
if ( m_auto != nullptr ) return false; if ( m_auto != nullptr ) return false;
auto autoJostle = MakeUnique<CAutoJostle>(this); auto autoJostle = std::make_unique<CAutoJostle>(this);
autoJostle->Start(0, force); autoJostle->Start(0, force);
m_auto = std::move(autoJostle); m_auto = std::move(autoJostle);
} }
@ -2789,7 +2788,7 @@ void COldObject::SetSelect(bool select, bool bDisplayError)
{ {
if ( m_objectInterface == nullptr ) if ( m_objectInterface == nullptr )
{ {
m_objectInterface = MakeUnique<Ui::CObjectInterface>(this); m_objectInterface = std::make_unique<Ui::CObjectInterface>(this);
} }
m_objectInterface->CreateInterface(m_bSelect); m_objectInterface->CreateInterface(m_bSelect);
} }

View File

@ -19,8 +19,6 @@
#include "object/subclass/base_alien.h" #include "object/subclass/base_alien.h"
#include "common/make_unique.h"
#include "level/parser/parserline.h" #include "level/parser/parserline.h"
#include "level/parser/parserparam.h" #include "level/parser/parserparam.h"
@ -48,32 +46,32 @@ std::unique_ptr<CBaseAlien> CBaseAlien::Create(
Gfx::COldModelManager* modelManager, Gfx::COldModelManager* modelManager,
Gfx::CEngine* engine) Gfx::CEngine* engine)
{ {
auto obj = MakeUnique<CBaseAlien>(params.id, params.type); auto obj = std::make_unique<CBaseAlien>(params.id, params.type);
obj->SetTeam(params.team); obj->SetTeam(params.team);
std::unique_ptr<CPhysics> physics = MakeUnique<CPhysics>(obj.get()); std::unique_ptr<CPhysics> physics = std::make_unique<CPhysics>(obj.get());
std::unique_ptr<CMotion> motion; std::unique_ptr<CMotion> motion;
if ( params.type == OBJECT_MOTHER ) if ( params.type == OBJECT_MOTHER )
{ {
motion = MakeUnique<CMotionQueen>(obj.get()); motion = std::make_unique<CMotionQueen>(obj.get());
} }
if ( params.type == OBJECT_ANT ) if ( params.type == OBJECT_ANT )
{ {
motion = MakeUnique<CMotionAnt>(obj.get()); motion = std::make_unique<CMotionAnt>(obj.get());
} }
if ( params.type == OBJECT_SPIDER ) if ( params.type == OBJECT_SPIDER )
{ {
motion = MakeUnique<CMotionSpider>(obj.get()); motion = std::make_unique<CMotionSpider>(obj.get());
} }
if ( params.type == OBJECT_BEE ) if ( params.type == OBJECT_BEE )
{ {
motion = MakeUnique<CMotionBee>(obj.get()); motion = std::make_unique<CMotionBee>(obj.get());
} }
if ( params.type == OBJECT_WORM ) if ( params.type == OBJECT_WORM )
{ {
motion = MakeUnique<CMotionWorm>(obj.get()); motion = std::make_unique<CMotionWorm>(obj.get());
} }
assert(motion != nullptr); assert(motion != nullptr);
@ -110,5 +108,5 @@ void CBaseAlien::Write(CLevelParserLine* line)
COldObject::Write(line); COldObject::Write(line);
if (GetFixed()) if (GetFixed())
line->AddParam("fixed", MakeUnique<CLevelParserParam>(GetFixed())); line->AddParam("fixed", std::make_unique<CLevelParserParam>(GetFixed()));
} }

View File

@ -19,8 +19,6 @@
#include "object/subclass/base_building.h" #include "object/subclass/base_building.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/oldmodelmanager.h" #include "graphics/engine/oldmodelmanager.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
@ -63,7 +61,7 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
Gfx::COldModelManager* modelManager, Gfx::COldModelManager* modelManager,
Gfx::CEngine* engine) Gfx::CEngine* engine)
{ {
auto obj = MakeUnique<CBaseBuilding>(params.id, params.type); auto obj = std::make_unique<CBaseBuilding>(params.id, params.type);
obj->SetTrainer(params.trainer || obj->GetPlusTrainer()); obj->SetTrainer(params.trainer || obj->GetPlusTrainer());
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -810,75 +808,75 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
std::unique_ptr<CAuto> objAuto; std::unique_ptr<CAuto> objAuto;
if ( params.type == OBJECT_BASE ) if ( params.type == OBJECT_BASE )
{ {
objAuto = MakeUnique<CAutoBase>(obj.get()); objAuto = std::make_unique<CAutoBase>(obj.get());
} }
if ( params.type == OBJECT_PORTICO ) if ( params.type == OBJECT_PORTICO )
{ {
objAuto = MakeUnique<CAutoPortico>(obj.get()); objAuto = std::make_unique<CAutoPortico>(obj.get());
} }
if ( params.type == OBJECT_DERRICK ) if ( params.type == OBJECT_DERRICK )
{ {
objAuto = MakeUnique<CAutoDerrick>(obj.get()); objAuto = std::make_unique<CAutoDerrick>(obj.get());
} }
if ( params.type == OBJECT_FACTORY ) if ( params.type == OBJECT_FACTORY )
{ {
objAuto = MakeUnique<CAutoFactory>(obj.get()); objAuto = std::make_unique<CAutoFactory>(obj.get());
} }
if ( params.type == OBJECT_REPAIR ) if ( params.type == OBJECT_REPAIR )
{ {
objAuto = MakeUnique<CAutoRepair>(obj.get()); objAuto = std::make_unique<CAutoRepair>(obj.get());
} }
if ( params.type == OBJECT_DESTROYER ) if ( params.type == OBJECT_DESTROYER )
{ {
objAuto = MakeUnique<CAutoDestroyer>(obj.get()); objAuto = std::make_unique<CAutoDestroyer>(obj.get());
} }
if ( params.type == OBJECT_STATION ) if ( params.type == OBJECT_STATION )
{ {
objAuto = MakeUnique<CAutoPowerStation>(obj.get()); objAuto = std::make_unique<CAutoPowerStation>(obj.get());
} }
if ( params.type == OBJECT_CONVERT ) if ( params.type == OBJECT_CONVERT )
{ {
objAuto = MakeUnique<CAutoConvert>(obj.get()); objAuto = std::make_unique<CAutoConvert>(obj.get());
} }
if ( params.type == OBJECT_TOWER ) if ( params.type == OBJECT_TOWER )
{ {
objAuto = MakeUnique<CAutoTower>(obj.get()); objAuto = std::make_unique<CAutoTower>(obj.get());
} }
if ( params.type == OBJECT_RESEARCH ) if ( params.type == OBJECT_RESEARCH )
{ {
objAuto = MakeUnique<CAutoResearch>(obj.get()); objAuto = std::make_unique<CAutoResearch>(obj.get());
} }
if ( params.type == OBJECT_RADAR ) if ( params.type == OBJECT_RADAR )
{ {
objAuto = MakeUnique<CAutoRadar>(obj.get()); objAuto = std::make_unique<CAutoRadar>(obj.get());
} }
if ( params.type == OBJECT_ENERGY ) if ( params.type == OBJECT_ENERGY )
{ {
objAuto = MakeUnique<CAutoPowerPlant>(obj.get()); objAuto = std::make_unique<CAutoPowerPlant>(obj.get());
} }
if ( params.type == OBJECT_LABO ) if ( params.type == OBJECT_LABO )
{ {
objAuto = MakeUnique<CAutoLabo>(obj.get()); objAuto = std::make_unique<CAutoLabo>(obj.get());
} }
if ( params.type == OBJECT_NUCLEAR ) if ( params.type == OBJECT_NUCLEAR )
{ {
objAuto = MakeUnique<CAutoNuclearPlant>(obj.get()); objAuto = std::make_unique<CAutoNuclearPlant>(obj.get());
} }
if ( params.type == OBJECT_PARA ) if ( params.type == OBJECT_PARA )
{ {
objAuto = MakeUnique<CAutoPowerCaptor>(obj.get()); objAuto = std::make_unique<CAutoPowerCaptor>(obj.get());
} }
if ( params.type == OBJECT_SAFE ) if ( params.type == OBJECT_SAFE )
{ {
objAuto = MakeUnique<CAutoVault>(obj.get()); objAuto = std::make_unique<CAutoVault>(obj.get());
} }
if ( params.type == OBJECT_HUSTON ) if ( params.type == OBJECT_HUSTON )
{ {
objAuto = MakeUnique<CAutoHouston>(obj.get()); objAuto = std::make_unique<CAutoHouston>(obj.get());
} }
if ( params.type == OBJECT_NEST ) if ( params.type == OBJECT_NEST )
{ {
objAuto = MakeUnique<CAutoNest>(obj.get()); objAuto = std::make_unique<CAutoNest>(obj.get());
} }
if (objAuto != nullptr) if (objAuto != nullptr)

View File

@ -19,8 +19,6 @@
#include "object/subclass/base_robot.h" #include "object/subclass/base_robot.h"
#include "common/make_unique.h"
#include "graphics/engine/oldmodelmanager.h" #include "graphics/engine/oldmodelmanager.h"
#include "object/object_create_params.h" #include "object/object_create_params.h"
@ -45,14 +43,14 @@ std::unique_ptr<CBaseRobot> CBaseRobot::Create(
Gfx::COldModelManager* modelManager, Gfx::COldModelManager* modelManager,
Gfx::CEngine* engine) Gfx::CEngine* engine)
{ {
auto obj = MakeUnique<CBaseRobot>(params.id, params.type); auto obj = std::make_unique<CBaseRobot>(params.id, params.type);
obj->SetOption(params.option); obj->SetOption(params.option);
obj->SetTeam(params.team); obj->SetTeam(params.team);
if ( params.type == OBJECT_TOTO ) if ( params.type == OBJECT_TOTO )
{ {
auto motion = MakeUnique<CMotionToto>(obj.get()); auto motion = std::make_unique<CMotionToto>(obj.get());
motion->Create(params.pos, params.angle, params.type, 1.0f, modelManager); motion->Create(params.pos, params.angle, params.type, 1.0f, modelManager);
obj->SetMovable(std::move(motion), nullptr); obj->SetMovable(std::move(motion), nullptr);
return obj; return obj;
@ -70,21 +68,21 @@ std::unique_ptr<CBaseRobot> CBaseRobot::Create(
obj->SetToy(params.toy); obj->SetToy(params.toy);
auto physics = MakeUnique<CPhysics>(obj.get()); auto physics = std::make_unique<CPhysics>(obj.get());
std::unique_ptr<CMotion> motion; std::unique_ptr<CMotion> motion;
if ( params.type == OBJECT_HUMAN || if ( params.type == OBJECT_HUMAN ||
params.type == OBJECT_TECH ) params.type == OBJECT_TECH )
{ {
motion = MakeUnique<CMotionHuman>(obj.get()); motion = std::make_unique<CMotionHuman>(obj.get());
} }
else if ( params.type == OBJECT_CONTROLLER ) else if ( params.type == OBJECT_CONTROLLER )
{ {
motion = MakeUnique<CMotionLevelController>(obj.get()); motion = std::make_unique<CMotionLevelController>(obj.get());
} }
else else
{ {
motion = MakeUnique<CMotionVehicle>(obj.get()); motion = std::make_unique<CMotionVehicle>(obj.get());
} }
motion->SetPhysics(physics.get()); motion->SetPhysics(physics.get());

View File

@ -19,7 +19,6 @@
#include "object/subclass/exchange_post.h" #include "object/subclass/exchange_post.h"
#include "common/make_unique.h"
#include "common/regex_utils.h" #include "common/regex_utils.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
@ -52,7 +51,7 @@ std::unique_ptr<CExchangePost> CExchangePost::Create(
Gfx::COldModelManager* modelManager, Gfx::COldModelManager* modelManager,
Gfx::CEngine* engine) Gfx::CEngine* engine)
{ {
auto obj = MakeUnique<CExchangePost>(params.id); auto obj = std::make_unique<CExchangePost>(params.id);
obj->SetTeam(params.team); obj->SetTeam(params.team);
@ -101,7 +100,7 @@ std::unique_ptr<CExchangePost> CExchangePost::Create(
pos.y += params.height; pos.y += params.height;
obj->SetPosition(pos); // to display the shadows immediately obj->SetPosition(pos); // to display the shadows immediately
auto objAuto = MakeUnique<CAutoInfo>(obj.get()); auto objAuto = std::make_unique<CAutoInfo>(obj.get());
objAuto->Init(); objAuto->Init();
obj->SetAuto(std::move(objAuto)); obj->SetAuto(std::move(objAuto));
@ -205,7 +204,7 @@ void CExchangePost::Write(CLevelParserLine* line)
{ {
auto key = "info" + boost::lexical_cast<std::string>(i); auto key = "info" + boost::lexical_cast<std::string>(i);
auto paramValue = info.name + "=" + boost::lexical_cast<std::string>(info.value); auto paramValue = info.name + "=" + boost::lexical_cast<std::string>(info.value);
line->AddParam(key, MakeUnique<CLevelParserParam>(paramValue)); line->AddParam(key, std::make_unique<CLevelParserParam>(paramValue));
} }
} }
} }
@ -670,11 +669,11 @@ bool CAutoInfo::Write(CLevelParserLine* line)
if (m_phase == Phase::Wait) if (m_phase == Phase::Wait)
return false; return false;
line->AddParam("aExist", MakeUnique<CLevelParserParam>(true)); line->AddParam("aExist", std::make_unique<CLevelParserParam>(true));
CAuto::Write(line); CAuto::Write(line);
line->AddParam("aPhase", MakeUnique<CLevelParserParam>(static_cast<int>(m_phase))); line->AddParam("aPhase", std::make_unique<CLevelParserParam>(static_cast<int>(m_phase)));
line->AddParam("aProgress", MakeUnique<CLevelParserParam>(m_progress)); line->AddParam("aProgress", std::make_unique<CLevelParserParam>(m_progress));
line->AddParam("aSpeed", MakeUnique<CLevelParserParam>(m_speed)); line->AddParam("aSpeed", std::make_unique<CLevelParserParam>(m_speed));
return true; return true;
} }

View File

@ -19,8 +19,6 @@
#include "object/subclass/shielder.h" #include "object/subclass/shielder.h"
#include "common/make_unique.h"
#include "graphics/engine/oldmodelmanager.h" #include "graphics/engine/oldmodelmanager.h"
#include "level/parser/parserline.h" #include "level/parser/parserline.h"
@ -49,14 +47,14 @@ std::unique_ptr<CShielder> CShielder::Create(
Gfx::CEngine* engine) Gfx::CEngine* engine)
{ {
assert(params.type == OBJECT_MOBILErs); assert(params.type == OBJECT_MOBILErs);
auto obj = MakeUnique<CShielder>(params.id); auto obj = std::make_unique<CShielder>(params.id);
obj->SetTeam(params.team); obj->SetTeam(params.team);
obj->SetTrainer(params.trainer || obj->GetPlusTrainer()); obj->SetTrainer(params.trainer || obj->GetPlusTrainer());
obj->SetToy(params.toy); obj->SetToy(params.toy);
auto physics = MakeUnique<CPhysics>(obj.get()); auto physics = std::make_unique<CPhysics>(obj.get());
auto motion = MakeUnique<CMotionVehicle>(obj.get()); auto motion = std::make_unique<CMotionVehicle>(obj.get());
motion->SetPhysics(physics.get()); motion->SetPhysics(physics.get());
physics->SetMotion(motion.get()); physics->SetMotion(motion.get());
@ -109,5 +107,5 @@ void CShielder::Write(CLevelParserLine* line)
{ {
COldObject::Write(line); COldObject::Write(line);
line->AddParam("bShieldActive", MakeUnique<CLevelParserParam>(IsBackgroundTask())); line->AddParam("bShieldActive", std::make_unique<CLevelParserParam>(IsBackgroundTask()));
} }

View File

@ -19,8 +19,6 @@
#include "object/subclass/static_object.h" #include "object/subclass/static_object.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
@ -141,7 +139,7 @@ CStaticObjectUPtr CStaticObject::Create(int id,
if (model.GetMeshCount() != 1 || model.GetMesh("main") == nullptr) if (model.GetMeshCount() != 1 || model.GetMesh("main") == nullptr)
throw CObjectCreateException("Unexpected mesh configuration", type, modelFile); throw CObjectCreateException("Unexpected mesh configuration", type, modelFile);
return MakeUnique<CStaticObject>(id, type, modelFile, adjustedPosition, angleY, model, engine); return std::make_unique<CStaticObject>(id, type, modelFile, adjustedPosition, angleY, model, engine);
} }
catch (const Gfx::CModelIOException& e) catch (const Gfx::CModelIOException& e)
{ {

View File

@ -23,7 +23,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/global.h" #include "common/global.h"
#include "common/image.h" #include "common/image.h"
#include "common/make_unique.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
@ -120,7 +119,7 @@ bool CTaskGoto::EventProcess(const Event &event)
{ {
if (m_bmArray != nullptr) if (m_bmArray != nullptr)
{ {
std::unique_ptr<CImage> debugImage = MakeUnique<CImage>(glm::ivec2(m_bmSize, m_bmSize)); std::unique_ptr<CImage> debugImage = std::make_unique<CImage>(glm::ivec2(m_bmSize, m_bmSize));
debugImage->Fill(Gfx::IntColor(255, 255, 255, 255)); debugImage->Fill(Gfx::IntColor(255, 255, 255, 255));
for (int x = 0; x < m_bmSize; x++) for (int x = 0; x < m_bmSize; x++)
{ {
@ -2100,7 +2099,7 @@ bool CTaskGoto::BitmapOpen()
BitmapClose(); BitmapClose();
m_bmSize = static_cast<int>(3200.0f/BM_DIM_STEP); m_bmSize = static_cast<int>(3200.0f/BM_DIM_STEP);
m_bmArray = MakeUniqueArray<unsigned char>(m_bmSize*m_bmSize/8*2); m_bmArray = std::make_unique<unsigned char[]>(m_bmSize * m_bmSize / 8 * 2);
m_bmChanged = true; m_bmChanged = true;
m_bmOffset = m_bmSize/2; m_bmOffset = m_bmSize/2;

View File

@ -24,7 +24,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/global.h" #include "common/global.h"
#include "common/make_unique.h"
#include "graphics/engine/camera.h" #include "graphics/engine/camera.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
@ -162,15 +161,15 @@ void CPhysics::SetMotion(CMotion* motion)
bool CPhysics::Write(CLevelParserLine* line) bool CPhysics::Write(CLevelParserLine* line)
{ {
line->AddParam("motor", MakeUnique<CLevelParserParam>(m_motorSpeed)); line->AddParam("motor", std::make_unique<CLevelParserParam>(m_motorSpeed));
if ( m_object->Implements(ObjectInterfaceType::Flying) ) if ( m_object->Implements(ObjectInterfaceType::Flying) )
{ {
if ( m_object->Implements(ObjectInterfaceType::JetFlying) ) if ( m_object->Implements(ObjectInterfaceType::JetFlying) )
{ {
line->AddParam("reactorRange", MakeUnique<CLevelParserParam>(m_object->GetReactorRange())); line->AddParam("reactorRange", std::make_unique<CLevelParserParam>(m_object->GetReactorRange()));
} }
line->AddParam("land", MakeUnique<CLevelParserParam>(GetLand())); line->AddParam("land", std::make_unique<CLevelParserParam>(GetLand()));
} }
return true; return true;

View File

@ -105,7 +105,7 @@ void CScript::PutScript(Ui::CEdit* edit, const char* name)
bool CScript::GetScript(Ui::CEdit* edit) bool CScript::GetScript(Ui::CEdit* edit)
{ {
int len = edit->GetTextLength(); int len = edit->GetTextLength();
m_script = MakeUniqueArray<char>(len+2); m_script = std::make_unique<char[]>(len + 2);
std::string tmp = edit->GetText(len+1); std::string tmp = edit->GetText(len+1);
strncpy(m_script.get(), tmp.c_str(), len+1); strncpy(m_script.get(), tmp.c_str(), len+1);
@ -237,7 +237,7 @@ bool CScript::Compile()
if (m_botProg == nullptr) if (m_botProg == nullptr)
{ {
m_botProg = MakeUnique<CBot::CBotProgram>(m_object->GetBotVar()); m_botProg = std::make_unique<CBot::CBotProgram>(m_object->GetBotVar());
} }
if ( m_botProg->Compile(m_script.get(), functionList, this) ) if ( m_botProg->Compile(m_script.get(), functionList, this) )
@ -804,7 +804,7 @@ bool CScript::IntroduceVirus()
int start = found[i+1]; int start = found[i+1];
i = found[i+0]; i = found[i+0];
auto newScript = MakeUniqueArray<char>(m_len + strlen(names[i+1]) + 1); auto newScript = std::make_unique<char[]>(m_len + strlen(names[i + 1]) + 1);
strcpy(newScript.get(), m_script.get()); strcpy(newScript.get(), m_script.get());
m_script = std::move(newScript); m_script = std::move(newScript);

View File

@ -25,7 +25,6 @@
#include "common/global.h" #include "common/global.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/resources/inputstream.h" #include "common/resources/inputstream.h"
#include "common/resources/outputstream.h" #include "common/resources/outputstream.h"
@ -3317,7 +3316,7 @@ public:
{ {
if (mode == CBotFileAccessHandler::OpenMode::Read) if (mode == CBotFileAccessHandler::OpenMode::Read)
{ {
auto is = MakeUnique<CInputStream>(filename); auto is = std::make_unique<CInputStream>(filename);
if (is->is_open()) if (is->is_open())
{ {
m_file = std::move(is); m_file = std::move(is);
@ -3325,7 +3324,7 @@ public:
} }
else if (mode == CBotFileAccessHandler::OpenMode::Write) else if (mode == CBotFileAccessHandler::OpenMode::Write)
{ {
auto os = MakeUnique<COutputStream>(filename); auto os = std::make_unique<COutputStream>(filename);
if (os->is_open()) if (os->is_open())
{ {
m_file = std::move(os); m_file = std::move(os);
@ -3333,7 +3332,7 @@ public:
} }
else if (mode == CBotFileAccessHandler::OpenMode::Append) else if (mode == CBotFileAccessHandler::OpenMode::Append)
{ {
auto os = MakeUnique<COutputStream>(filename, std::ios_base::app); auto os = std::make_unique<COutputStream>(filename, std::ios_base::app);
if (os->is_open()) if (os->is_open())
{ {
m_file = std::move(os); m_file = std::move(os);
@ -3405,7 +3404,7 @@ class CBotFileAccessHandlerColobot : public CBotFileAccessHandler
public: public:
virtual std::unique_ptr<CBotFile> OpenFile(const std::string& filename, OpenMode mode) override virtual std::unique_ptr<CBotFile> OpenFile(const std::string& filename, OpenMode mode) override
{ {
return MakeUnique<CBotFileColobot>(PrepareFilename(filename), mode); return std::make_unique<CBotFileColobot>(PrepareFilename(filename), mode);
} }
virtual bool DeleteFile(const std::string& filename) override virtual bool DeleteFile(const std::string& filename) override
@ -3613,7 +3612,7 @@ void CScriptFunctions::Init()
CBotProgram::AddFunction("research", rResearch, cResearch); CBotProgram::AddFunction("research", rResearch, cResearch);
CBotProgram::AddFunction("destroy", rDestroy, cOneObject); CBotProgram::AddFunction("destroy", rDestroy, cOneObject);
SetFileAccessHandler(MakeUnique<CBotFileAccessHandlerColobot>()); SetFileAccessHandler(std::make_unique<CBotFileAccessHandlerColobot>());
} }

View File

@ -20,8 +20,6 @@
#include "sound/oalsound/alsound.h" #include "sound/oalsound/alsound.h"
#include "common/make_unique.h"
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>
@ -138,7 +136,7 @@ int CALSound::GetMusicVolume()
bool CALSound::Cache(SoundType sound, const std::string &filename) bool CALSound::Cache(SoundType sound, const std::string &filename)
{ {
auto buffer = MakeUnique<CBuffer>(); auto buffer = std::make_unique<CBuffer>();
if (buffer->LoadFromFile(filename, sound)) if (buffer->LoadFromFile(filename, sound))
{ {
m_sounds[sound] = std::move(buffer); m_sounds[sound] = std::move(buffer);
@ -153,7 +151,7 @@ void CALSound::CacheMusic(const std::string &filename)
{ {
if (m_music.find(filename) == m_music.end()) if (m_music.find(filename) == m_music.end())
{ {
auto buffer = MakeUnique<CBuffer>(); auto buffer = std::make_unique<CBuffer>();
if (buffer->LoadFromFile(filename, static_cast<SoundType>(-1))) if (buffer->LoadFromFile(filename, static_cast<SoundType>(-1)))
{ {
m_music[filename] = std::move(buffer); m_music[filename] = std::move(buffer);
@ -246,7 +244,7 @@ bool CALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoad
// just add a new channel if we dont have any // just add a new channel if we dont have any
if (m_channels.size() == 0) if (m_channels.size() == 0)
{ {
auto chn = MakeUnique<CChannel>(); auto chn = std::make_unique<CChannel>();
// check if we channel ready to play music, if not report error // check if we channel ready to play music, if not report error
if (chn->IsReady()) if (chn->IsReady())
{ {
@ -271,7 +269,7 @@ bool CALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoad
{ {
if (m_channels.find(i) == m_channels.end()) if (m_channels.find(i) == m_channels.end())
{ {
auto chn = MakeUnique<CChannel>(); auto chn = std::make_unique<CChannel>();
// check if channel is ready to play music, if not destroy it and seek free one // check if channel is ready to play music, if not destroy it and seek free one
if (chn->IsReady()) if (chn->IsReady())
{ {
@ -597,7 +595,7 @@ void CALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTim
{ {
GetLogger()->Debug("Music %s was not cached!\n", filename.c_str()); GetLogger()->Debug("Music %s was not cached!\n", filename.c_str());
auto newBuffer = MakeUnique<CBuffer>(); auto newBuffer = std::make_unique<CBuffer>();
buffer = newBuffer.get(); buffer = newBuffer.get();
if (!newBuffer->LoadFromFile(filename, static_cast<SoundType>(-1))) if (!newBuffer->LoadFromFile(filename, static_cast<SoundType>(-1)))
{ {
@ -620,7 +618,7 @@ void CALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTim
m_oldMusic.push_back(std::move(old)); m_oldMusic.push_back(std::move(old));
} }
m_currentMusic = MakeUnique<CChannel>(); m_currentMusic = std::make_unique<CChannel>();
m_currentMusic->SetBuffer(buffer); m_currentMusic->SetBuffer(buffer);
m_currentMusic->SetVolume(m_musicVolume); m_currentMusic->SetVolume(m_musicVolume);
m_currentMusic->SetLoop(repeat); m_currentMusic->SetLoop(repeat);

View File

@ -26,7 +26,6 @@
#include "app/input.h" #include "app/input.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "common/resources/inputstream.h" #include "common/resources/inputstream.h"
@ -186,7 +185,7 @@ bool CEdit::Create(const glm::vec2& pos, const glm::vec2& dim, int icon, EventTy
{ {
m_bMulti = true; m_bMulti = true;
MoveAdjust(); // readjusts multi-line mode MoveAdjust(); // readjusts multi-line mode
m_scroll = MakeUnique<Ui::CScroll>(); m_scroll = std::make_unique<Ui::CScroll>();
m_scroll->Create(pos, dim, -1, EVENT_NULL); m_scroll->Create(pos, dim, -1, EVENT_NULL);
MoveAdjust(); MoveAdjust();
} }

View File

@ -21,7 +21,6 @@
#include "ui/controls/editvalue.h" #include "ui/controls/editvalue.h"
#include "common/event.h" #include "common/event.h"
#include "common/make_unique.h"
#include "level/robotmain.h" #include "level/robotmain.h"
@ -63,15 +62,15 @@ bool CEditValue::Create(const glm::vec2& pos, const glm::vec2& dim, int icon, Ev
GlintDelete(); GlintDelete();
m_edit = MakeUnique<Ui::CEdit>(); m_edit = std::make_unique<Ui::CEdit>();
m_edit->Create(pos, dim, 0, EVENT_NULL); m_edit->Create(pos, dim, 0, EVENT_NULL);
m_edit->SetMaxChar(4); m_edit->SetMaxChar(4);
m_buttonUp = MakeUnique<Ui::CButton>(); m_buttonUp = std::make_unique<Ui::CButton>();
m_buttonUp->Create(pos, dim, 49, EVENT_NULL); // ^ m_buttonUp->Create(pos, dim, 49, EVENT_NULL); // ^
m_buttonUp->SetRepeat(true); m_buttonUp->SetRepeat(true);
m_buttonDown = MakeUnique<Ui::CButton>(); m_buttonDown = std::make_unique<Ui::CButton>();
m_buttonDown->Create(pos, dim, 50, EVENT_NULL); // v m_buttonDown->Create(pos, dim, 50, EVENT_NULL); // v
m_buttonDown->SetRepeat(true); m_buttonDown->SetRepeat(true);

View File

@ -95,7 +95,7 @@ ControlClass* CInterface::CreateControl(const glm::vec2& pos, const glm::vec2& d
if (index < 0) if (index < 0)
return nullptr; return nullptr;
auto control = MakeUnique<ControlClass>(); auto control = std::make_unique<ControlClass>();
control->Create(pos, dim, icon, eventMsg); control->Create(pos, dim, icon, eventMsg);
auto* controlPtr = control.get(); auto* controlPtr = control.get();
m_controls[index] = std::move(control); m_controls[index] = std::move(control);
@ -130,7 +130,7 @@ CWindow* CInterface::CreateWindows(const glm::vec2& pos, const glm::vec2& dim, i
if (index < 0) if (index < 0)
return nullptr; return nullptr;
auto window = MakeUnique<CWindow>(); auto window = std::make_unique<CWindow>();
window->Create(pos, dim, icon, eventMsg); window->Create(pos, dim, icon, eventMsg);
auto* windowPtr = window.get(); auto* windowPtr = window.get();
m_controls[index] = std::move(window); m_controls[index] = std::move(window);
@ -237,7 +237,7 @@ CList* CInterface::CreateList(const glm::vec2& pos, const glm::vec2& dim, int ic
if (index < 0) if (index < 0)
return nullptr; return nullptr;
auto list = MakeUnique<CList>(); auto list = std::make_unique<CList>();
list->Create(pos, dim, icon, eventMsg, expand); list->Create(pos, dim, icon, eventMsg, expand);
auto* listPtr = list.get(); auto* listPtr = list.get();
m_controls[index] = std::move(list); m_controls[index] = std::move(list);

View File

@ -20,8 +20,6 @@
#include "ui/controls/list.h" #include "ui/controls/list.h"
#include "common/make_unique.h"
#include "graphics/core/device.h" #include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
#include "graphics/core/transparency.h" #include "graphics/core/transparency.h"
@ -82,7 +80,7 @@ bool CList::Create(const glm::vec2& pos, const glm::vec2& dim, int icon, EventTy
CControl::Create(pos, dim, icon, eventMsg); CControl::Create(pos, dim, icon, eventMsg);
m_scroll = MakeUnique<CScroll>(); m_scroll = std::make_unique<CScroll>();
m_scroll->Create(pos, dim, 0, EVENT_NULL); m_scroll->Create(pos, dim, 0, EVENT_NULL);
return MoveAdjust(); return MoveAdjust();
@ -140,7 +138,7 @@ bool CList::MoveAdjust()
ddim.y = h; ddim.y = h;
for (int i = 0; i < m_displayLine; i++) for (int i = 0; i < m_displayLine; i++)
{ {
auto button = MakeUnique<CButton>(); auto button = std::make_unique<CButton>();
button->Create(ppos, ddim, -1, EVENT_NULL); button->Create(ppos, ddim, -1, EVENT_NULL);
button->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); button->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
button->SetState(STATE_SIMPLY); button->SetState(STATE_SIMPLY);

View File

@ -21,7 +21,6 @@
#include "ui/controls/scroll.h" #include "ui/controls/scroll.h"
#include "common/event.h" #include "common/event.h"
#include "common/make_unique.h"
#include "graphics/core/device.h" #include "graphics/core/device.h"
#include "graphics/core/renderers.h" #include "graphics/core/renderers.h"
@ -94,14 +93,14 @@ void CScroll::MoveAdjust()
{ {
if (m_buttonUp == nullptr) if (m_buttonUp == nullptr)
{ {
m_buttonUp = MakeUnique<CButton>(); m_buttonUp = std::make_unique<CButton>();
m_buttonUp->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, 49, EVENT_NULL); m_buttonUp->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, 49, EVENT_NULL);
m_buttonUp->SetRepeat(true); m_buttonUp->SetRepeat(true);
} }
if (m_buttonDown == nullptr) if (m_buttonDown == nullptr)
{ {
m_buttonDown = MakeUnique<CButton>(); m_buttonDown = std::make_unique<CButton>();
m_buttonDown->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, 50, EVENT_NULL); m_buttonDown->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, 50, EVENT_NULL);
m_buttonDown->SetRepeat(true); m_buttonDown->SetRepeat(true);
} }

View File

@ -108,7 +108,7 @@ void CSlider::MoveAdjust()
{ {
if (m_buttonLeft == nullptr) if (m_buttonLeft == nullptr)
{ {
m_buttonLeft = MakeUnique<CButton>(); m_buttonLeft = std::make_unique<CButton>();
m_buttonLeft->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, m_bHoriz ? 55 : 49, EVENT_NULL); // </^ m_buttonLeft->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, m_bHoriz ? 55 : 49, EVENT_NULL); // </^
m_buttonLeft->SetRepeat(true); m_buttonLeft->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonLeft->SetState(STATE_SHADOW); if ( m_state & STATE_SHADOW ) m_buttonLeft->SetState(STATE_SHADOW);
@ -116,7 +116,7 @@ void CSlider::MoveAdjust()
if (m_buttonRight == nullptr) if (m_buttonRight == nullptr)
{ {
m_buttonRight = MakeUnique<CButton>(); m_buttonRight = std::make_unique<CButton>();
m_buttonRight->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, m_bHoriz ? 48 : 50, EVENT_NULL); // >/v m_buttonRight->Create({ 0.0f, 0.0f }, { 0.0f, 0.0f }, m_bHoriz ? 48 : 50, EVENT_NULL); // >/v
m_buttonRight->SetRepeat(true); m_buttonRight->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonRight->SetState(STATE_SHADOW); if ( m_state & STATE_SHADOW ) m_buttonRight->SetState(STATE_SHADOW);

View File

@ -103,7 +103,7 @@ bool CWindow::Create(const glm::vec2& pos, const glm::vec2& dim, int icon, Event
template<typename ControlClass> template<typename ControlClass>
ControlClass* CWindow::CreateControl(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg) ControlClass* CWindow::CreateControl(const glm::vec2& pos, const glm::vec2& dim, int icon, EventType eventMsg)
{ {
auto control = MakeUnique<ControlClass>(); auto control = std::make_unique<ControlClass>();
control->Create(pos, dim, icon, eventMsg); control->Create(pos, dim, icon, eventMsg);
auto* controlPtr = control.get(); auto* controlPtr = control.get();
m_controls.push_back(std::move(control)); m_controls.push_back(std::move(control));
@ -220,7 +220,7 @@ CList* CWindow::CreateList(const glm::vec2& pos, const glm::vec2& dim, int icon,
if (eventMsg == EVENT_NULL) if (eventMsg == EVENT_NULL)
eventMsg = GetUniqueEventType(); eventMsg = GetUniqueEventType();
auto list = MakeUnique<CList>(); auto list = std::make_unique<CList>();
list->Create(pos, dim, icon, eventMsg, expand); list->Create(pos, dim, icon, eventMsg, expand);
auto* listPtr = list.get(); auto* listPtr = list.get();
m_controls.push_back(std::move(list)); m_controls.push_back(std::move(list));
@ -351,10 +351,10 @@ void CWindow::SetName(std::string name, bool tooltip)
if ( m_name.length() > 0 && m_bRedim ) // title bar exists? if ( m_name.length() > 0 && m_bRedim ) // title bar exists?
{ {
m_buttonReduce = MakeUnique<CButton>(); m_buttonReduce = std::make_unique<CButton>();
m_buttonReduce->Create(m_pos, m_dim, 0, EVENT_NULL); m_buttonReduce->Create(m_pos, m_dim, 0, EVENT_NULL);
m_buttonFull = MakeUnique<CButton>(); m_buttonFull = std::make_unique<CButton>();
m_buttonFull->Create(m_pos, m_dim, 0, EVENT_NULL); m_buttonFull->Create(m_pos, m_dim, 0, EVENT_NULL);
bAdjust = true; bAdjust = true;
@ -362,7 +362,7 @@ void CWindow::SetName(std::string name, bool tooltip)
if ( m_name.length() > 0 && m_bClosable ) // title bar exists? if ( m_name.length() > 0 && m_bClosable ) // title bar exists?
{ {
m_buttonClose = MakeUnique<CButton>(); m_buttonClose = std::make_unique<CButton>();
m_buttonClose->Create(m_pos, m_dim, 0, EVENT_NULL); m_buttonClose->Create(m_pos, m_dim, 0, EVENT_NULL);
bAdjust = true; bAdjust = true;

View File

@ -26,7 +26,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/settings.h" #include "common/settings.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"

View File

@ -24,7 +24,6 @@
#include "common/event.h" #include "common/event.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/make_unique.h"
#include "common/settings.h" #include "common/settings.h"
#include "common/resources/resourcemanager.h" #include "common/resources/resourcemanager.h"
@ -80,24 +79,24 @@ CMainUserInterface::CMainUserInterface()
m_sound = m_app->GetSound(); m_sound = m_app->GetSound();
m_settings = CSettings::GetInstancePointer(); m_settings = CSettings::GetInstancePointer();
m_dialog = MakeUnique<CMainDialog>(); m_dialog = std::make_unique<CMainDialog>();
m_screenAppearance = MakeUnique<CScreenApperance>(); m_screenAppearance = std::make_unique<CScreenApperance>();
m_screenLevelList = MakeUnique<CScreenLevelList>(m_dialog.get()); m_screenLevelList = std::make_unique<CScreenLevelList>(m_dialog.get());
m_screenIORead = MakeUnique<CScreenIORead>(m_screenLevelList.get()); m_screenIORead = std::make_unique<CScreenIORead>(m_screenLevelList.get());
m_screenIOWrite = MakeUnique<CScreenIOWrite>(m_screenLevelList.get()); m_screenIOWrite = std::make_unique<CScreenIOWrite>(m_screenLevelList.get());
m_screenLoading = MakeUnique<CScreenLoading>(); m_screenLoading = std::make_unique<CScreenLoading>();
m_screenModList = MakeUnique<CScreenModList>(m_dialog.get(), m_app->GetModManager()); m_screenModList = std::make_unique<CScreenModList>(m_dialog.get(), m_app->GetModManager());
m_screenSetupControls = MakeUnique<CScreenSetupControls>(); m_screenSetupControls = std::make_unique<CScreenSetupControls>();
m_screenSetupDisplay = MakeUnique<CScreenSetupDisplay>(); m_screenSetupDisplay = std::make_unique<CScreenSetupDisplay>();
m_screenSetupGame = MakeUnique<CScreenSetupGame>(); m_screenSetupGame = std::make_unique<CScreenSetupGame>();
m_screenSetupGraphics = MakeUnique<CScreenSetupGraphics>(); m_screenSetupGraphics = std::make_unique<CScreenSetupGraphics>();
m_screenSetupSound = MakeUnique<CScreenSetupSound>(); m_screenSetupSound = std::make_unique<CScreenSetupSound>();
m_screenMainMenu = MakeUnique<CScreenMainMenu>(); m_screenMainMenu = std::make_unique<CScreenMainMenu>();
m_screenPlayerSelect = MakeUnique<CScreenPlayerSelect>(m_dialog.get()); m_screenPlayerSelect = std::make_unique<CScreenPlayerSelect>(m_dialog.get());
m_screenQuit = MakeUnique<CScreenQuit>(); m_screenQuit = std::make_unique<CScreenQuit>();
m_screenWelcome = MakeUnique<CScreenWelcome>(); m_screenWelcome = std::make_unique<CScreenWelcome>();
m_mouseParticlesGenerator = MakeUnique<UI::CParticlesGenerator>(); m_mouseParticlesGenerator = std::make_unique<UI::CParticlesGenerator>();
m_currentScreen = nullptr; m_currentScreen = nullptr;

View File

@ -740,7 +740,7 @@ void CObjectInterface::StartEditScript(Program* program, std::string name)
{ {
CreateInterface(false); // removes the control buttons CreateInterface(false); // removes the control buttons
m_studio = MakeUnique<CStudio>(); m_studio = std::make_unique<CStudio>();
m_studio->StartEditScript(program->script.get(), name, program); m_studio->StartEditScript(program->script.get(), name, program);
} }

View File

@ -984,12 +984,12 @@ void CStudio::StartDialog(const Event &event)
{ {
if ( event.type == EVENT_STUDIO_OPEN ) if ( event.type == EVENT_STUDIO_OPEN )
{ {
m_fileDialog = MakeUnique<CFileDialog>(); m_fileDialog = std::make_unique<CFileDialog>();
m_fileDialog->SetDialogType(CFileDialog::Type::Open); m_fileDialog->SetDialogType(CFileDialog::Type::Open);
} }
if ( event.type == EVENT_STUDIO_SAVE ) if ( event.type == EVENT_STUDIO_SAVE )
{ {
m_fileDialog = MakeUnique<CFileDialog>(); m_fileDialog = std::make_unique<CFileDialog>();
m_fileDialog->SetDialogType(CFileDialog::Type::Save); m_fileDialog->SetDialogType(CFileDialog::Type::Save);
} }

View File

@ -19,8 +19,6 @@
#include "app/app.h" #include "app/app.h"
#include "common/make_unique.h"
#include "common/system/system_other.h" #include "common/system/system_other.h"
#include <functional> #include <functional>
@ -40,7 +38,7 @@ public:
: CApplication(systemUtils) : CApplication(systemUtils)
{ {
SDL_Init(0); SDL_Init(0);
m_eventQueue = MakeUnique<CEventQueue>(); m_eventQueue = std::make_unique<CEventQueue>();
} }
~CApplicationWrapper() ~CApplicationWrapper()
@ -95,7 +93,7 @@ void CApplicationUT::SetUp()
m_mocks.OnCall(m_systemUtils, CSystemUtils::GetCurrentTimeStamp).Do(std::bind(&CApplicationUT::GetCurrentTimeStamp, this)); m_mocks.OnCall(m_systemUtils, CSystemUtils::GetCurrentTimeStamp).Do(std::bind(&CApplicationUT::GetCurrentTimeStamp, this));
m_app = MakeUnique<CApplicationWrapper>(m_systemUtils); m_app = std::make_unique<CApplicationWrapper>(m_systemUtils);
} }
void CApplicationUT::TearDown() void CApplicationUT::TearDown()