Skip to content

Commit

Permalink
replace virtual with override, remove most empty/not needed empty des…
Browse files Browse the repository at this point in the history
…tructors and constructors, 0 -> nullptr
  • Loading branch information
Altren committed Dec 29, 2018
1 parent a48ff1c commit ac7f50c
Show file tree
Hide file tree
Showing 426 changed files with 710 additions and 2,002 deletions.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,24 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_C
# to avoid warnings from OIS
ignore_warnings(${OIS_INCLUDE_DIR})
endif ()
if (MYGUI_RENDERSYSTEM EQUAL 4 OR MYGUI_RENDERSYSTEM EQUAL 7 OR MYGUI_RENDERSYSTEM EQUAL 8)
# to avoid warnings from SDL2
ignore_warnings(${SDL2_INCLUDE_DIRS})

if (NOT MSVC)
# violated in glew.h
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-id-macro")
endif ()
endif ()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything")
# useful, TODO
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
# might be useful
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-exceptions -Wno-documentation-unknown-command -Wno-unknown-warning-option -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-old-style-cast")
# not useful
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-var-template -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-c++11-extensions -Wno-float-equal -Wno-padded -Wno-padded -Wno-weak-vtables -Wno-duplicate-enum -Wno-exit-time-destructors -Wno-unused-parameter -Wno-global-constructors")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes -Wno-reorder -Wno-undefined-var-template -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-c++11-extensions -Wno-float-equal -Wno-padded -Wno-padded -Wno-weak-vtables -Wno-duplicate-enum -Wno-exit-time-destructors -Wno-unused-parameter -Wno-global-constructors")
else ()
# very interesting option, but way too many warnings
#add_definitions(-Weffc++)
Expand Down
22 changes: 9 additions & 13 deletions Common/Base/DirectX/BaseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ namespace base
{
}

BaseManager::~BaseManager()
{
}

void BaseManager::_windowResized()
{
RECT rect = { 0, 0, 0, 0 };
Expand All @@ -105,14 +101,14 @@ namespace base
// регистрируем класс окна
WNDCLASS wc =
{
0, (WNDPROC)DXWndProc, 0, 0, GetModuleHandle(NULL), LoadIcon(NULL, MAKEINTRESOURCE(1001)),
LoadCursor(NULL, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), NULL, TEXT(WND_CLASS_NAME),
0, (WNDPROC)DXWndProc, 0, 0, GetModuleHandle(nullptr), LoadIcon(nullptr, MAKEINTRESOURCE(1001)),
LoadCursor(nullptr, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), nullptr, TEXT(WND_CLASS_NAME),
};
RegisterClass(&wc);

// создаем главное окно
hWnd = CreateWindow(wc.lpszClassName, TEXT("Direct3D9 Render Window"), WS_POPUP,
0, 0, 0, 0, GetDesktopWindow(), NULL, wc.hInstance, this);
0, 0, 0, 0, GetDesktopWindow(), nullptr, wc.hInstance, this);
if (!hWnd)
{
//OutException("fatal error!", "failed create window");
Expand Down Expand Up @@ -155,7 +151,7 @@ namespace base
MSG msg;
while (true)
{
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
Expand Down Expand Up @@ -212,8 +208,8 @@ namespace base
{
if (node->findAttribute("root") != "")
{
bool root = MyGUI::utility::parseBool(node->findAttribute("root"));
if (root)
bool rootAttribute = MyGUI::utility::parseBool(node->findAttribute("root"));
if (rootAttribute)
mRootMedia = node->getContent();
}
addResourceLocation(node->getContent(), false);
Expand Down Expand Up @@ -431,7 +427,7 @@ namespace base

if (hr == D3DERR_INVALIDCALL)
{
MessageBox( NULL, "Call to Reset() failed with D3DERR_INVALIDCALL! ",
MessageBox( nullptr, "Call to Reset() failed with D3DERR_INVALIDCALL! ",
"ERROR", MB_OK | MB_ICONEXCLAMATION );
}

Expand Down Expand Up @@ -504,12 +500,12 @@ namespace base

if (SUCCEEDED(mDevice->BeginScene()))
{
mDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x001589FF, 1.0f, 0);
mDevice->Clear(0, nullptr, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x001589FF, 1.0f, 0);
mPlatform->getRenderManagerPtr()->drawOneFrame();
mDevice->EndScene();
}

if (mDevice->Present(NULL, NULL, 0, NULL) == D3DERR_DEVICELOST)
if (mDevice->Present(nullptr, nullptr, 0, nullptr) == D3DERR_DEVICELOST)
mIsDeviceLost = true;
}

Expand Down
1 change: 0 additions & 1 deletion Common/Base/DirectX/BaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace base
{
public:
BaseManager();
virtual ~BaseManager();

virtual void prepare(); // инициализация коммандной строки
bool create(int _width = 1024, int _height = 768); // создаем начальную точки каркаса приложения
Expand Down
30 changes: 13 additions & 17 deletions Common/Base/DirectX11/BaseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ namespace base
{
}

BaseManager::~BaseManager()
{
}

void BaseManager::_windowResized()
{
RECT rect = { 0, 0, 0, 0 };
Expand All @@ -104,14 +100,14 @@ namespace base
// регистрируем класс окна
WNDCLASS wc =
{
0, (WNDPROC)DXWndProc, 0, 0, GetModuleHandle(NULL), LoadIcon(NULL, MAKEINTRESOURCE(1001)),
LoadCursor(NULL, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), NULL, TEXT(WND_CLASS_NAME),
0, (WNDPROC)DXWndProc, 0, 0, GetModuleHandle(nullptr), LoadIcon(nullptr, MAKEINTRESOURCE(1001)),
LoadCursor(nullptr, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), nullptr, TEXT(WND_CLASS_NAME),
};
RegisterClass(&wc);

// создаем главное окно
hWnd = CreateWindow(wc.lpszClassName, TEXT("Direct3D11 Render Window"), WS_POPUP,
0, 0, 0, 0, GetDesktopWindow(), NULL, wc.hInstance, this);
0, 0, 0, 0, GetDesktopWindow(), nullptr, wc.hInstance, this);
if (!hWnd)
{
//OutException("fatal error!", "failed create window");
Expand Down Expand Up @@ -154,7 +150,7 @@ namespace base
MSG msg;
while (true)
{
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
Expand Down Expand Up @@ -211,8 +207,8 @@ namespace base
{
if (node->findAttribute("root") != "")
{
bool root = MyGUI::utility::parseBool(node->findAttribute("root"));
if (root)
bool rootAttribute = MyGUI::utility::parseBool(node->findAttribute("root"));
if (rootAttribute)
mRootMedia = node->getContent();
}
addResourceLocation(node->getContent(), false);
Expand Down Expand Up @@ -423,7 +419,7 @@ namespace base
{

// Release the current render target view and its back buffer
mDeviceContext->OMSetRenderTargets(0, NULL, NULL);
mDeviceContext->OMSetRenderTargets(0, nullptr, nullptr);
if (mRenderTarget)
{
mRenderTarget->Release();
Expand All @@ -441,9 +437,9 @@ namespace base
mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBuffer);

// Create a new render target from the resized buffer
mDevice->CreateRenderTargetView(mBackBuffer, NULL, &mRenderTarget);
mDevice->CreateRenderTargetView(mBackBuffer, nullptr, &mRenderTarget);
// Set the new render target
mDeviceContext->OMSetRenderTargets(1, &mRenderTarget, NULL);
mDeviceContext->OMSetRenderTargets(1, &mRenderTarget, nullptr);

// Устанавливаем новый вьюпорт
D3D11_VIEWPORT vp;
Expand Down Expand Up @@ -494,9 +490,9 @@ namespace base
HRESULT hr = S_OK;

// Пытаемся создать девайс
if ( FAILED (hr = D3D11CreateDeviceAndSwapChain( NULL,
if ( FAILED (hr = D3D11CreateDeviceAndSwapChain( nullptr,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
nullptr,
0,
featureLevels,
numFeatureLevels,
Expand All @@ -514,10 +510,10 @@ namespace base
hr = mSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&mBackBuffer);

// Создаём render target для back buffer
mDevice->CreateRenderTargetView(mBackBuffer, NULL, &mRenderTarget );
mDevice->CreateRenderTargetView(mBackBuffer, nullptr, &mRenderTarget );

// Устанавливаем back buffer rt текущим
mDeviceContext->OMSetRenderTargets( 1, &mRenderTarget, NULL );
mDeviceContext->OMSetRenderTargets( 1, &mRenderTarget, nullptr );

// Устанавливаем вьюпорт
D3D11_VIEWPORT vp;
Expand Down
1 change: 0 additions & 1 deletion Common/Base/DirectX11/BaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ namespace base
{
public:
BaseManager();
virtual ~BaseManager();

virtual void prepare(); // инициализация коммандной строки
bool create(int _width = 1024, int _height = 768); // создаем начальную точки каркаса приложения
Expand Down
12 changes: 4 additions & 8 deletions Common/Base/Dummy/BaseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ namespace base
{
}

BaseManager::~BaseManager()
{
}

void BaseManager::_windowResized()
{
RECT rect = { 0, 0, 0, 0 };
Expand All @@ -92,14 +88,14 @@ namespace base
// регистрируем класс окна
WNDCLASS wc =
{
0, (WNDPROC)DXWndProc, 0, 0, GetModuleHandle(NULL), LoadIcon(NULL, MAKEINTRESOURCE(1001)),
LoadCursor(NULL, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), NULL, TEXT(WND_CLASS_NAME),
0, (WNDPROC)DXWndProc, 0, 0, GetModuleHandle(nullptr), LoadIcon(nullptr, MAKEINTRESOURCE(1001)),
LoadCursor(nullptr, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), nullptr, TEXT(WND_CLASS_NAME),
};
RegisterClass(&wc);

// создаем главное окно
hWnd = CreateWindow(wc.lpszClassName, TEXT("Dummy Render Window"), WS_OVERLAPPED | WS_SYSMENU,
(GetSystemMetrics(SM_CXSCREEN) - width) / 2, (GetSystemMetrics(SM_CYSCREEN) - height) / 2, width, height, GetDesktopWindow(), NULL, wc.hInstance, this);
(GetSystemMetrics(SM_CXSCREEN) - width) / 2, (GetSystemMetrics(SM_CYSCREEN) - height) / 2, width, height, GetDesktopWindow(), nullptr, wc.hInstance, this);
if (!hWnd)
{
return false;
Expand Down Expand Up @@ -139,7 +135,7 @@ namespace base
MSG msg;
while (true)
{
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
Expand Down
1 change: 0 additions & 1 deletion Common/Base/Dummy/BaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace base
{
public:
BaseManager();
virtual ~BaseManager();

virtual void prepare(); // инициализация коммандной строки
bool create(int _width = 1024, int _height = 768); // создаем начальную точки каркаса приложения
Expand Down
6 changes: 3 additions & 3 deletions Common/Base/Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int startApp()
#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
// set working directory to exe location
LPSTR fileName = new CHAR[256];
GetModuleFileName(NULL, fileName, 256);
GetModuleFileName(nullptr, fileName, 256);
std::string path = fileName;
int path_directory_index = path.find_last_of('\\');
std::string exedir = path.substr(0, path_directory_index + 1);
Expand All @@ -63,12 +63,12 @@ int startApp()
app->destroy();
}
delete app;
app = 0;
app = nullptr;
}
catch (MyGUI::Exception& _e)
{
#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
MessageBoxA( NULL, _e.getFullDescription().c_str(), "An exception has occured", MB_OK | MB_ICONERROR | MB_TASKMODAL);
MessageBoxA( nullptr, _e.getFullDescription().c_str(), "An exception has occured", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
std::cerr << "An exception has occured" << " : " << _e.getFullDescription().c_str();
#endif
Expand Down
8 changes: 2 additions & 6 deletions Common/Base/Ogre/BaseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ namespace base
#endif
}

BaseManager::~BaseManager()
{
}

bool BaseManager::create(int _width, int _height)
{
Ogre::String pluginsPath;
Expand Down Expand Up @@ -327,8 +323,8 @@ namespace base
{
if (node->findAttribute("root") != "")
{
bool rootAttr = MyGUI::utility::parseBool(node->findAttribute("root"));
if (rootAttr)
bool rootAttribute = MyGUI::utility::parseBool(node->findAttribute("root"));
if (rootAttribute)
mRootMedia = node->getContent();
}
addResourceLocation(node->getContent());
Expand Down
1 change: 0 additions & 1 deletion Common/Base/Ogre/BaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ namespace base
{
public:
BaseManager();
virtual ~BaseManager();

virtual void prepare();
bool create(int _width = 1024, int _height = 768);
Expand Down
8 changes: 2 additions & 6 deletions Common/Base/OpenGL/BaseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ namespace base
{
}

BaseManager::~BaseManager()
{
}

void BaseManager::_windowResized( int w, int h )
{
MyGUI::RenderManager::getInstance().setViewSize(w, h);
Expand Down Expand Up @@ -190,8 +186,8 @@ namespace base
{
if (node->findAttribute("root") != "")
{
bool root = MyGUI::utility::parseBool(node->findAttribute("root"));
if (root)
bool rootAttribute = MyGUI::utility::parseBool(node->findAttribute("root"));
if (rootAttribute)
mRootMedia = node->getContent();
}
addResourceLocation(node->getContent(), false);
Expand Down
1 change: 0 additions & 1 deletion Common/Base/OpenGL/BaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace base
{
public:
BaseManager();
virtual ~BaseManager();

virtual void prepare();
bool create(int _width = 1024, int _height = 768);
Expand Down
11 changes: 4 additions & 7 deletions Common/Base/OpenGL3/BaseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <SDL_image.h>
#include "GL/glew.h"


namespace base
{
BaseManager::BaseManager() :
Expand All @@ -19,10 +20,6 @@ namespace base
{
}

BaseManager::~BaseManager()
{
}

void BaseManager::_windowResized( int w, int h )
{
MyGUI::RenderManager::getInstance().setViewSize(w, h);
Expand Down Expand Up @@ -138,6 +135,7 @@ namespace base
case SDL_WINDOWEVENT_MINIMIZED:
case SDL_WINDOWEVENT_HIDDEN:
mWindowOn = false;
break;
default:
break;
}
Expand Down Expand Up @@ -190,8 +188,8 @@ namespace base
{
if (node->findAttribute("root") != "")
{
bool root = MyGUI::utility::parseBool(node->findAttribute("root"));
if (root)
bool rootAttribute = MyGUI::utility::parseBool(node->findAttribute("root"));
if (rootAttribute)
mRootMedia = node->getContent();
}
addResourceLocation(node->getContent(), false);
Expand Down Expand Up @@ -375,7 +373,6 @@ namespace base
SDL_LockSurface(_image);

int pitchSrc = _image->pitch; //the length of a row of pixels in bytes
int bppSrc = pitchSrc / _image->w;
size_t size = _image->h * pitchSrc;
ret = new unsigned char[size];
unsigned char* ptr_source = (unsigned char*)_image->pixels;
Expand Down
1 change: 0 additions & 1 deletion Common/Base/OpenGL3/BaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace base
{
public:
BaseManager();
virtual ~BaseManager();

virtual void prepare();
bool create(int _width = 1024, int _height = 768);
Expand Down
Loading

0 comments on commit ac7f50c

Please sign in to comment.