From d11ebc891ccd433cbc478c3312612eb826523026 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 3 Oct 2015 22:05:14 +0200 Subject: [PATCH] Bring to zero some types of issues reported by colobot-lint --- src/CBot/CBotClass.cpp | 4 + src/CBot/CBotDll.h | 4 + src/CBot/CBotVar.cpp | 5 + src/app/app.cpp | 9 +- src/app/input.cpp | 10 +- src/app/input.h | 2 +- src/app/main.cpp | 2 +- src/app/pausemanager.cpp | 16 ++- src/app/pausemanager.h | 19 +-- src/app/signal_handlers.cpp | 7 +- src/app/system.cpp | 5 +- src/common/logger.cpp | 4 +- src/common/regex_utils.cpp | 4 +- src/common/regex_utils.h | 6 +- src/graphics/engine/camera.cpp | 4 +- src/graphics/engine/camera.h | 2 +- src/graphics/engine/cloud.h | 2 +- src/graphics/engine/engine.cpp | 6 +- src/graphics/engine/engine.h | 11 +- src/graphics/engine/lightman.cpp | 8 +- src/graphics/engine/lightman.h | 6 +- src/graphics/engine/pyro.h | 2 +- src/graphics/engine/terrain.cpp | 26 ++-- src/graphics/engine/terrain.h | 2 +- src/graphics/engine/text.cpp | 4 +- src/graphics/engine/text.h | 4 +- src/graphics/model/model_input.cpp | 4 +- src/level/parser/parser.h | 3 +- src/level/robotmain.cpp | 40 +++--- src/level/robotmain.h | 22 ++-- src/level/scene_conditions.cpp | 4 +- src/object/auto/auto.cpp | 8 +- src/object/auto/auto.h | 5 +- src/object/auto/autobase.cpp | 2 - src/object/auto/autobase.h | 2 +- src/object/auto/autoconvert.cpp | 8 +- src/object/auto/autoconvert.h | 2 +- src/object/auto/autoderrick.cpp | 2 - src/object/auto/autoderrick.h | 2 +- src/object/auto/autodestroyer.cpp | 2 - src/object/auto/autoegg.cpp | 2 +- src/object/auto/autoegg.h | 2 +- src/object/auto/autofactory.cpp | 6 +- src/object/auto/autofactory.h | 2 +- src/object/auto/autolabo.cpp | 4 +- src/object/auto/autonest.h | 2 +- src/object/auto/autonuclearplant.cpp | 4 +- src/object/auto/autonuclearplant.h | 2 +- src/object/auto/autopowercaptor.cpp | 4 +- src/object/auto/autopowerplant.h | 2 +- src/object/auto/autoresearch.h | 2 +- .../implementation/program_storage_impl.cpp | 2 +- src/object/implementation/programmable_impl.h | 7 +- src/object/interface/trace_drawing_object.h | 4 +- src/object/object.cpp | 4 +- src/object/old_object.h | 13 +- src/object/subclass/base_alien.cpp | 4 +- src/object/subclass/base_building.cpp | 2 +- src/object/subclass/base_robot.cpp | 4 +- src/object/subclass/shielder.cpp | 2 +- src/object/task/taskgoto.cpp | 2 +- src/object/task/taskpen.h | 5 +- src/object/task/taskterraform.cpp | 4 +- src/script/scriptfunc.cpp | 10 +- src/sound/oalsound/alsound.cpp | 118 +++++++----------- src/sound/oalsound/alsound.h | 16 +-- src/sound/oalsound/buffer.cpp | 21 ++-- src/sound/oalsound/buffer.h | 6 +- src/sound/oalsound/channel.cpp | 114 ++++++----------- src/sound/oalsound/channel.h | 12 +- src/sound/sound.cpp | 2 +- src/ui/controls/button.cpp | 4 +- src/ui/controls/button.h | 2 +- src/ui/controls/list.cpp | 4 +- src/ui/controls/list.h | 2 +- src/ui/controls/slider.h | 2 +- src/ui/controls/target.h | 2 +- src/ui/displaytext.h | 2 +- src/ui/maindialog.cpp | 4 +- src/ui/mainui.cpp | 12 +- src/ui/object_interface.h | 2 +- src/ui/screen/screen.cpp | 4 +- src/ui/screen/screen_io.cpp | 6 +- src/ui/screen/screen_io_read.cpp | 2 +- src/ui/screen/screen_io_write.cpp | 2 +- src/ui/screen/screen_player_select.cpp | 13 +- src/ui/studio.cpp | 6 +- test/unit/app/app_test.cpp | 48 +++---- test/unit/app/system_linux_test.cpp | 4 +- test/unit/app/system_windows_test.cpp | 4 +- test/unit/common/config_file_test.cpp | 3 +- test/unit/graphics/engine/lightman_test.cpp | 32 ++--- 92 files changed, 383 insertions(+), 441 deletions(-) diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp index be44e1a5..3e1e0077 100644 --- a/src/CBot/CBotClass.cpp +++ b/src/CBot/CBotClass.cpp @@ -72,6 +72,10 @@ CBotClass::~CBotClass() delete m_next; // releases all of them on this level } +CBotClass* CBotClass::Create(const char* name, CBotClass* parent, bool intrinsic) +{ + return new CBotClass(name, parent, intrinsic); +} void CBotClass::Free() { diff --git a/src/CBot/CBotDll.h b/src/CBot/CBotDll.h index 37972560..bcb02d18 100644 --- a/src/CBot/CBotDll.h +++ b/src/CBot/CBotDll.h @@ -610,6 +610,8 @@ virtual ~CBotVar( ); // destructor static CBotVar* Create( CBotVar* pVar ); + static void Destroy(CBotVar* var); + void SetUserPtr(void* pUser); // associate a user pointer to an instance @@ -807,6 +809,8 @@ public: ~CBotClass( ); // destructor + static CBotClass* Create(const char* name, CBotClass* parent, bool intrinsic = false); + bool AddFunction(const char* name, bool rExec (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception, void* user), CBotTypResult rCompile (CBotVar* pThis, CBotVar* &pVar)); diff --git a/src/CBot/CBotVar.cpp b/src/CBot/CBotVar.cpp index 5deb935f..da5119f8 100644 --- a/src/CBot/CBotVar.cpp +++ b/src/CBot/CBotVar.cpp @@ -444,6 +444,11 @@ CBotVar* CBotVar::Create( const char* name, CBotClass* pClass) return pVar; } +void CBotVar::Destroy(CBotVar* var) +{ + delete var; +} + CBotTypResult CBotVar::GetTypResult(int mode) { CBotTypResult r = m_type; diff --git a/src/app/app.cpp b/src/app/app.cpp index b83a45f4..5c124083 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -19,8 +19,6 @@ #include "app/app.h" -#include "common/version.h" - #include "app/controller.h" #include "app/input.h" #include "app/system.h" @@ -32,6 +30,7 @@ #include "common/make_unique.h" #include "common/pathman.h" #include "common/stringutils.h" +#include "common/version.h" #include "common/resources/resourcemanager.h" @@ -39,10 +38,10 @@ #include "graphics/opengl/glutil.h" -#include "object/object_manager.h" - #include "level/robotmain.h" +#include "object/object_manager.h" + #ifdef OPENAL_SOUND #include "sound/oalsound/alsound.h" #endif @@ -479,7 +478,7 @@ bool CApplication::Create() #ifdef OPENAL_SOUND if (!m_headless) { - m_sound = MakeUnique(); + m_sound = MakeUnique(); } else { diff --git a/src/app/input.cpp b/src/app/input.cpp index ff75d917..228b5e9e 100644 --- a/src/app/input.cpp +++ b/src/app/input.cpp @@ -404,19 +404,19 @@ InputSlot CInput::SearchKeyById(std::string id) return INPUT_SLOT_MAX; } -std::string CInput::GetKeysString(InputBinding b) +std::string CInput::GetKeysString(InputBinding binding) { std::ostringstream ss; - if ( b.primary != KEY_INVALID ) + if ( binding.primary != KEY_INVALID ) { std::string iNameStr; - if ( GetResource(RES_KEY, b.primary, iNameStr) ) + if ( GetResource(RES_KEY, binding.primary, iNameStr) ) { ss << iNameStr; - if ( b.secondary != KEY_INVALID ) + if ( binding.secondary != KEY_INVALID ) { - if ( GetResource(RES_KEY, b.secondary, iNameStr) ) + if ( GetResource(RES_KEY, binding.secondary, iNameStr) ) { std::string textStr; GetResource(RES_TEXT, RT_KEY_OR, textStr); diff --git a/src/app/input.h b/src/app/input.h index 771267b8..e9e3b035 100644 --- a/src/app/input.h +++ b/src/app/input.h @@ -131,7 +131,7 @@ public: //@} //! Seeks a InputSlot by id. Returns INPUT_SLOT_MAX if not found - InputSlot SearchKeyById(std::string name); + InputSlot SearchKeyById(std::string id); //! Returns string describing keys to be pressed //@{ diff --git a/src/app/main.cpp b/src/app/main.cpp index 0845d5ad..7d3e6656 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -23,7 +23,6 @@ */ #include "common/config.h" -#include "common/version.h" #include "app/app.h" #include "app/signal_handlers.h" @@ -35,6 +34,7 @@ #include "common/logger.h" #include "common/make_unique.h" #include "common/restext.h" +#include "common/version.h" #include "common/resources/resourcemanager.h" diff --git a/src/app/pausemanager.cpp b/src/app/pausemanager.cpp index ba867a69..64a0b9df 100644 --- a/src/app/pausemanager.cpp +++ b/src/app/pausemanager.cpp @@ -27,6 +27,20 @@ #include +struct ActivePause +{ + explicit ActivePause(PauseType type, PauseMusic music = PAUSE_MUSIC_NONE) + : type(type), + music(music) + {} + + ActivePause(const ActivePause&) = delete; + ActivePause& operator=(const ActivePause&) = delete; + + PauseType type; + PauseMusic music; +}; + CPauseManager::CPauseManager() { @@ -39,7 +53,7 @@ CPauseManager::~CPauseManager() ActivePause* CPauseManager::ActivatePause(PauseType type, PauseMusic music) { //GetLogger()->Debug("Activated pause mode - %s\n", GetPauseName(type).c_str()); - auto pause = std::unique_ptr(new ActivePause(type, music)); // TODO: Can't use MakeUnique here because the constructor is private + auto pause = MakeUnique(type, music); ActivePause* ptr = pause.get(); m_activePause.push_back(std::move(pause)); Update(); diff --git a/src/app/pausemanager.h b/src/app/pausemanager.h index b6c261ff..d5ba1d7c 100644 --- a/src/app/pausemanager.h +++ b/src/app/pausemanager.h @@ -23,6 +23,8 @@ */ #pragma once +#include "common/make_unique.h" + #include #include #include @@ -63,22 +65,7 @@ enum PauseMusic PAUSE_MUSIC_SATCOM = 2, }; -struct ActivePause -{ -private: - friend class CPauseManager; - - explicit ActivePause(PauseType type, PauseMusic music = PAUSE_MUSIC_NONE) - : type(type) - , music(music) - {} - - ActivePause(const ActivePause&) = delete; - ActivePause& operator=(const ActivePause&) = delete; - - PauseType type; - PauseMusic music; -}; +struct ActivePause; class CPauseManager { diff --git a/src/app/signal_handlers.cpp b/src/app/signal_handlers.cpp index f00a8d84..618f323d 100644 --- a/src/app/signal_handlers.cpp +++ b/src/app/signal_handlers.cpp @@ -19,13 +19,12 @@ #include "app/signal_handlers.h" -#include "common/version.h" - -#include "common/resources/resourcemanager.h" - #include "app/system.h" #include "common/stringutils.h" +#include "common/version.h" + +#include "common/resources/resourcemanager.h" #include "level/robotmain.h" diff --git a/src/app/system.cpp b/src/app/system.cpp index e0ea2ba0..01450c4a 100644 --- a/src/app/system.cpp +++ b/src/app/system.cpp @@ -22,9 +22,6 @@ #include "common/config.h" -#include "common/make_unique.h" - - #if defined(PLATFORM_WINDOWS) #include "app/system_windows.h" #elif defined(PLATFORM_LINUX) @@ -35,6 +32,8 @@ #include "app/system_other.h" #endif +#include "common/make_unique.h" + #include #include diff --git a/src/common/logger.cpp b/src/common/logger.cpp index 2217f5e3..2d3f9b7d 100644 --- a/src/common/logger.cpp +++ b/src/common/logger.cpp @@ -151,9 +151,9 @@ bool CLogger::IsOpened() return m_file != nullptr; } -void CLogger::SetLogLevel(LogLevel type) +void CLogger::SetLogLevel(LogLevel level) { - m_logLevel = type; + m_logLevel = level; } bool CLogger::ParseLogLevel(const std::string& str, LogLevel& logLevel) diff --git a/src/common/regex_utils.cpp b/src/common/regex_utils.cpp index 27086ca2..1796cd0c 100644 --- a/src/common/regex_utils.cpp +++ b/src/common/regex_utils.cpp @@ -25,7 +25,7 @@ std::string FormatAssertRegexMatchError(const std::string& text, return "Text \"" + text + "\" did not match regex \"" + pattern + "\""; } -RegexUtils::AssertRegexMatchError::AssertRegexMatchError( +RegexUtils::CAssertRegexMatchError::CAssertRegexMatchError( const std::string& text, const std::string& pattern) NOEXCEPT : std::runtime_error(FormatAssertRegexMatchError(text, pattern)) { @@ -37,7 +37,7 @@ boost::smatch RegexUtils::AssertRegexMatch(const std::string& text, const std::s boost::smatch matches; bool ok = boost::regex_match(text, matches, regex); if (!ok) - throw AssertRegexMatchError(text, pattern); + throw CAssertRegexMatchError(text, pattern); return matches; } diff --git a/src/common/regex_utils.h b/src/common/regex_utils.h index 5c0e100c..7f5b83f6 100644 --- a/src/common/regex_utils.h +++ b/src/common/regex_utils.h @@ -26,11 +26,11 @@ namespace RegexUtils { -class AssertRegexMatchError : public std::runtime_error +class CAssertRegexMatchError : public std::runtime_error { public: - explicit AssertRegexMatchError(const std::string& text, - const std::string& pattern) NOEXCEPT; + explicit CAssertRegexMatchError(const std::string& text, + const std::string& pattern) NOEXCEPT; }; //! Match string with regex and return list of matches; throw exception on mismatch diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp index 62e6edb9..a1dc6989 100644 --- a/src/graphics/engine/camera.cpp +++ b/src/graphics/engine/camera.cpp @@ -859,8 +859,8 @@ void CCamera::FixCamera() } void CCamera::SetViewTime(const Math::Vector &eyePt, - const Math::Vector &lookatPt, - float rTime) + const Math::Vector &lookatPt, + float rTime) { Math::Vector eye, lookat; diff --git a/src/graphics/engine/camera.h b/src/graphics/engine/camera.h index 453f9947..72c6f29c 100644 --- a/src/graphics/engine/camera.h +++ b/src/graphics/engine/camera.h @@ -249,7 +249,7 @@ protected: bool EventFrameScript(const Event &event); //! Specifies the location and direction of view to the 3D engine - void SetViewTime(const Math::Vector &vEyePt, const Math::Vector &vLookatPt, float rTime); + void SetViewTime(const Math::Vector &eyePt, const Math::Vector &lookatPt, float rTime); //! Avoid the obstacles bool IsCollision(Math::Vector &eye, Math::Vector lookat); //! Avoid the obstacles diff --git a/src/graphics/engine/cloud.h b/src/graphics/engine/cloud.h index 06e82ea9..89299ffe 100644 --- a/src/graphics/engine/cloud.h +++ b/src/graphics/engine/cloud.h @@ -74,7 +74,7 @@ public: //! Management of clouds //@{ - void SetEnabled(bool enable); + void SetEnabled(bool enabled); bool GetEnabled(); //@} diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 51eddf0d..29c6f927 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -4932,11 +4932,11 @@ int CEngine::GetEngineState(const ModelTriangle& triangle) return state; } -void CEngine::UpdateObjectShadowSpotNormal(int rank) +void CEngine::UpdateObjectShadowSpotNormal(int objRank) { - assert(rank >= 0 && rank < static_cast( m_objects.size() )); + assert(objRank >= 0 && objRank < static_cast( m_objects.size() )); - int shadowRank = m_objects[rank].shadowRank; + int shadowRank = m_objects[objRank].shadowRank; if (shadowRank == -1) return; diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h index c95dcb8d..9aebe83f 100644 --- a/src/graphics/engine/engine.h +++ b/src/graphics/engine/engine.h @@ -48,7 +48,6 @@ class CApplication; class CSoundInterface; class CImage; -class CPauseManager; class CSystemUtils; struct SystemTimeStamp; struct Event; @@ -717,7 +716,7 @@ public: //@} //! Increments the triangle counter for the current frame - void AddStatisticTriangle(int nb); + void AddStatisticTriangle(int count); //! Returns the number of triangles in current frame int GetStatisticTriangle(); @@ -778,7 +777,7 @@ public: // Objects //! Print debug info about an object - void DebugObject(int rank); + void DebugObject(int objRank); //! Creates a new object and returns its rank int CreateObject(); @@ -942,7 +941,7 @@ public: void SetTexture(const Texture& tex, int stage = 0); //! Deletes the given texture, unloading it and removing from cache - void DeleteTexture(const std::string& name); + void DeleteTexture(const std::string& texName); //! Deletes the given texture, unloading it and removing from cache void DeleteTexture(const Texture& tex); @@ -1215,7 +1214,7 @@ protected: //! Draws the mouse cursor void DrawMouse(); //! Draw part of mouse cursor sprite - void DrawMouseSprite(Math::Point pos, Math::Point dim, int icon); + void DrawMouseSprite(Math::Point pos, Math::Point size, int icon); //! Draw statistic texts void DrawStats(); //! Draw mission timer @@ -1225,7 +1224,7 @@ protected: EngineBaseObjTexTier& AddLevel2(EngineBaseObject& p1, const std::string& tex1Name, const std::string& tex2Name); //! Creates a new tier 3 object (data) EngineBaseObjDataTier& AddLevel3(EngineBaseObjTexTier &p3, EngineTriangleType type, - const Material& mat, int state); + const Material& material, int state); //! Create texture and add it to cache Texture CreateTexture(const std::string &texName, const TextureCreateParams ¶ms, CImage* image = nullptr); diff --git a/src/graphics/engine/lightman.cpp b/src/graphics/engine/lightman.cpp index 60f8c1ca..15b0335d 100644 --- a/src/graphics/engine/lightman.cpp +++ b/src/graphics/engine/lightman.cpp @@ -448,7 +448,7 @@ void CLightManager::UpdateDeviceLights(EngineObjectType type) m_lightMap[i] = -1; std::vector sortedLights = m_dynLights; - LightsComparator lightsComparator(m_engine->GetEyePt(), type); + CLightsComparator lightsComparator(m_engine->GetEyePt(), type); std::sort(sortedLights.begin(), sortedLights.end(), lightsComparator); int lightMapIndex = 0; @@ -497,13 +497,13 @@ void CLightManager::UpdateDeviceLights(EngineObjectType type) // ----------- -CLightManager::LightsComparator::LightsComparator(Math::Vector eyePos, EngineObjectType objectType) +CLightManager::CLightsComparator::CLightsComparator(Math::Vector eyePos, EngineObjectType objectType) { m_eyePos = eyePos; m_objectType = objectType; } -float CLightManager::LightsComparator::GetLightWeight(const DynamicLight& dynLight) +float CLightManager::CLightsComparator::GetLightWeight(const DynamicLight& dynLight) { if (dynLight.priority == LIGHT_PRI_HIGHEST) return -1.0f; @@ -519,7 +519,7 @@ float CLightManager::LightsComparator::GetLightWeight(const DynamicLight& dynLig return enabled ? ( (dynLight.light.position - m_eyePos).Length() * dynLight.priority ) : 10000.0f; } -bool CLightManager::LightsComparator::operator()(const DynamicLight& left, const DynamicLight& right) +bool CLightManager::CLightsComparator::operator()(const DynamicLight& left, const DynamicLight& right) { float leftWeight = GetLightWeight(left); float rightWeight = GetLightWeight(right); diff --git a/src/graphics/engine/lightman.h b/src/graphics/engine/lightman.h index 9d1eb5ea..ebf42d9d 100644 --- a/src/graphics/engine/lightman.h +++ b/src/graphics/engine/lightman.h @@ -168,7 +168,7 @@ public: //! Returns the light parameters for given dynamic light bool GetLight(int lightRank, Light &light); //! Enables/disables the given dynamic light - bool SetLightEnabled(int lightRank, bool enable); + bool SetLightEnabled(int lightRank, bool enabled); //! Changes the light priority bool SetLightPriority(int lightRank, LightPriority priority); @@ -212,10 +212,10 @@ public: void UpdateDeviceLights(EngineObjectType type); protected: - class LightsComparator + class CLightsComparator { public: - LightsComparator(Math::Vector eyePos, EngineObjectType objectType); + CLightsComparator(Math::Vector eyePos, EngineObjectType objectType); bool operator()(const DynamicLight& left, const DynamicLight& right); diff --git a/src/graphics/engine/pyro.h b/src/graphics/engine/pyro.h index 2289b78f..e98bf96d 100644 --- a/src/graphics/engine/pyro.h +++ b/src/graphics/engine/pyro.h @@ -93,7 +93,7 @@ protected: void DeleteObject(bool primary, bool secondary); //! Creates an explosion with triangular form of particles - void CreateTriangle(CObject* obj, ObjectType type, int part); + void CreateTriangle(CObject* obj, ObjectType oType, int part); //! Starts the explosion of a vehicle void ExploStart(); diff --git a/src/graphics/engine/terrain.cpp b/src/graphics/engine/terrain.cpp index 0d36a382..ae82c8fb 100644 --- a/src/graphics/engine/terrain.cpp +++ b/src/graphics/engine/terrain.cpp @@ -247,13 +247,13 @@ bool CTerrain::LoadResources(const std::string& fileName) return true; } -TerrainRes CTerrain::GetResource(const Math::Vector &p) +TerrainRes CTerrain::GetResource(const Math::Vector &pos) { if (m_resources.empty()) return TR_NULL; - int x = static_cast((p.x + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize); - int y = static_cast((p.z + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize); + int x = static_cast((pos.x + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize); + int y = static_cast((pos.z + (m_mosaicCount*m_brickCount*m_brickSize)/2.0f)/m_brickSize); if ( x < 0 || x > m_mosaicCount*m_brickCount || y < 0 || y > m_mosaicCount*m_brickCount ) @@ -1677,16 +1677,16 @@ bool CTerrain::DeleteBuildingLevel(Math::Vector center) return false; } -float CTerrain::GetBuildingFactor(const Math::Vector &p) +float CTerrain::GetBuildingFactor(const Math::Vector &pos) { for (int i = 0; i < static_cast( m_buildingLevels.size() ); i++) { - if ( p.x < m_buildingLevels[i].bboxMinX || - p.x > m_buildingLevels[i].bboxMaxX || - p.z < m_buildingLevels[i].bboxMinZ || - p.z > m_buildingLevels[i].bboxMaxZ ) continue; + if ( pos.x < m_buildingLevels[i].bboxMinX || + pos.x > m_buildingLevels[i].bboxMaxX || + pos.z < m_buildingLevels[i].bboxMinZ || + pos.z > m_buildingLevels[i].bboxMaxZ ) continue; - float dist = Math::DistanceProjected(p, m_buildingLevels[i].center); + float dist = Math::DistanceProjected(pos, m_buildingLevels[i].center); if (dist <= m_buildingLevels[i].max) return m_buildingLevels[i].factor; @@ -1730,9 +1730,9 @@ void CTerrain::AdjustBuildingLevel(Math::Vector &p) } } -float CTerrain::GetHardness(const Math::Vector &p) +float CTerrain::GetHardness(const Math::Vector &pos) { - float factor = GetBuildingFactor(p); + float factor = GetBuildingFactor(pos); if (factor != 1.0f) return 1.0f; // on building level if (m_materialPoints.empty()) return m_defaultHardness; @@ -1741,8 +1741,8 @@ float CTerrain::GetHardness(const Math::Vector &p) int x, y; - x = static_cast((p.x+dim)/m_brickSize); - y = static_cast((p.z+dim)/m_brickSize); + x = static_cast((pos.x+dim)/m_brickSize); + y = static_cast((pos.z+dim)/m_brickSize); if ( x < 0 || x > m_mosaicCount*m_brickCount || y < 0 || y > m_mosaicCount*m_brickCount ) return m_defaultHardness; diff --git a/src/graphics/engine/terrain.h b/src/graphics/engine/terrain.h index 3235f401..8c489c85 100644 --- a/src/graphics/engine/terrain.h +++ b/src/graphics/engine/terrain.h @@ -157,7 +157,7 @@ public: //! Clears all terrain materials void FlushMaterials(); //! Adds a terrain material the names of textures to use for the land - void AddMaterial(int id, const std::string& baseName, const Math::Point& uv, + void AddMaterial(int id, const std::string& texName, const Math::Point& uv, int up, int right, int down, int left, float hardness); //! Initializes all the ground with one material bool InitMaterials(int id); diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index d1003443..f5028d11 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -22,14 +22,14 @@ #include "app/app.h" -#include "graphics/engine/engine.h" - #include "common/image.h" #include "common/logger.h" #include "common/stringutils.h" #include "common/resources/resourcemanager.h" +#include "graphics/engine/engine.h" + #include "math/func.h" #include diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h index 6ce6be33..6f79320a 100644 --- a/src/graphics/engine/text.h +++ b/src/graphics/engine/text.h @@ -27,8 +27,8 @@ #include "graphics/core/color.h" -#include "math/point.h" #include "math/intpoint.h" +#include "math/point.h" #include #include @@ -309,7 +309,7 @@ public: CharTexture GetCharTexture(UTF8Char ch, FontType font, float size); protected: - CachedFont* GetOrOpenFont(FontType type, float size); + CachedFont* GetOrOpenFont(FontType font, float size); CharTexture CreateCharTexture(UTF8Char ch, CachedFont* font); void DrawString(const std::string &text, std::vector::iterator format, diff --git a/src/graphics/model/model_input.cpp b/src/graphics/model/model_input.cpp index a29e0420..c71c88f0 100644 --- a/src/graphics/model/model_input.cpp +++ b/src/graphics/model/model_input.cpp @@ -59,8 +59,8 @@ namespace ModelInput VertexTex2 ReadBinaryVertexTex2(std::istream& stream); Material ReadBinaryMaterial(std::istream& stream); - std::string ReadLineString(std::istream& stream, const std::string& prefix); - void ReadValuePrefix(std::istream& stream, const std::string& prefix); + std::string ReadLineString(std::istream& stream, const std::string& expectedPrefix); + void ReadValuePrefix(std::istream& stream, const std::string& expectedPrefix); VertexTex2 ParseVertexTex2(const std::string& text); Material ParseMaterial(const std::string& text); Math::Vector ParseVector(const std::string& text); diff --git a/src/level/parser/parser.h b/src/level/parser/parser.h index f3eb1286..4d78c59d 100644 --- a/src/level/parser/parser.h +++ b/src/level/parser/parser.h @@ -24,10 +24,9 @@ #pragma once -#include "level/level_category.h" - #include "common/make_unique.h" +#include "level/level_category.h" #include "level/robotmain.h" #include "level/parser/parserexceptions.h" diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp index 3d25495e..6290075e 100644 --- a/src/level/robotmain.cpp +++ b/src/level/robotmain.cpp @@ -502,15 +502,21 @@ void CRobotMain::ChangePhase(Phase phase) if (CResourceManager::DirectoryExists("crashsave")) { GetLogger()->Info("Pre-crash save found!\n"); - m_ui->GetDialog()->StartQuestion("Your game seems to have crashed. Do you want to restore pre-crash state?", false, false, false, [&]() { - GetLogger()->Info("Trying to restore pre-crash state...\n"); - assert(m_playerProfile != nullptr); - m_playerProfile->LoadScene("../../crashsave"); - CResourceManager::RemoveDirectory("crashsave"); - }, [&]() { - GetLogger()->Info("Not restoring pre-crash state\n"); - CResourceManager::RemoveDirectory("crashsave"); - }); + m_ui->GetDialog()->StartQuestion( + "Your game seems to have crashed. Do you want to restore pre-crash state?", false, false, false, + [&]() + { + GetLogger()->Info("Trying to restore pre-crash state...\n"); + assert(m_playerProfile != nullptr); + m_playerProfile->LoadScene("../../crashsave"); + CResourceManager::RemoveDirectory("crashsave"); + }, + [&]() + { + GetLogger()->Info("Not restoring pre-crash state\n"); + CResourceManager::RemoveDirectory("crashsave"); + } + ); } } @@ -1018,9 +1024,13 @@ bool CRobotMain::ProcessEvent(Event &event) break; case EVENT_OBJECT_DELETE: - m_ui->GetDialog()->StartQuestion(RT_DIALOG_DELOBJ, true, false, false, [&]() { - DestroySelectedObject(); - }); + m_ui->GetDialog()->StartQuestion( + RT_DIALOG_DELOBJ, true, false, false, + [&]() + { + DestroySelectedObject(); + } + ); break; case EVENT_OBJECT_BHELP: @@ -2256,9 +2266,9 @@ void CRobotMain::ChangeCamera() } //! Remote control the camera using the arrow keys -void CRobotMain::KeyCamera(EventType type, InputSlot key) +void CRobotMain::KeyCamera(EventType event, InputSlot key) { - if (type == EVENT_KEY_UP) + if (event == EVENT_KEY_UP) { if (key == INPUT_SLOT_LEFT) { @@ -2290,7 +2300,7 @@ void CRobotMain::KeyCamera(EventType type, InputSlot key) assert(obj->Implements(ObjectInterfaceType::Controllable)); if (!dynamic_cast(obj)->GetTrainer()) return; - if (type == EVENT_KEY_DOWN) + if (event == EVENT_KEY_DOWN) { if (key == INPUT_SLOT_LEFT) { diff --git a/src/level/robotmain.h b/src/level/robotmain.h index 3544ed36..30adec1f 100644 --- a/src/level/robotmain.h +++ b/src/level/robotmain.h @@ -30,14 +30,14 @@ #include "common/event.h" #include "common/singleton.h" +#include "graphics/engine/camera.h" +#include "graphics/engine/particle.h" + #include "level/build_type.h" #include "level/level_category.h" #include "level/mainmovie.h" #include "level/research_type.h" -#include "graphics/engine/camera.h" -#include "graphics/engine/particle.h" - #include "object/drive_type.h" #include "object/mission_type.h" #include "object/object_type.h" @@ -193,8 +193,8 @@ public: void SelectHuman(); CObject* SearchHuman(); CObject* SearchToto(); - CObject* SearchNearest(Math::Vector pos, CObject* pExclu); - bool SelectObject(CObject* pObj, bool displayError=true); + CObject* SearchNearest(Math::Vector pos, CObject* exclu); + bool SelectObject(CObject* obj, bool displayError=true); CObject* GetSelectObject(); CObject* DeselectAll(); @@ -259,15 +259,15 @@ public: void HideDropZone(CObject* metal); void ShowDropZone(CObject* metal, CObject* transporter); void FlushShowLimit(int i); - void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos, + void SetShowLimit(int i, Gfx::ParticleType parti, CObject *obj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME); void StartShowLimit(); void FrameShowLimit(float rTime); void SaveAllScript(); - void SaveOneScript(CObject *pObj); - bool SaveFileStack(CObject *pObj, FILE *file, int objRank); - bool ReadFileStack(CObject *pObj, FILE *file, int objRank); + void SaveOneScript(CObject *obj); + bool SaveFileStack(CObject *obj, FILE *file, int objRank); + bool ReadFileStack(CObject *obj, FILE *file, int objRank); void FlushNewScriptName(); void AddNewScriptName(ObjectType type, const std::string& name); @@ -365,7 +365,7 @@ public: void StartDetectEffect(COldObject* object, CObject* target); - bool IsSelectable(CObject* pObj); + bool IsSelectable(CObject* obj); protected: bool EventFrame(const Event &event); @@ -390,7 +390,7 @@ protected: void RemoteCamera(float pan, float zoom, float rTime); void KeyCamera(EventType event, InputSlot key); void AbortMovie(); - void SelectOneObject(CObject* pObj, bool displayError=true); + void SelectOneObject(CObject* obj, bool displayError=true); void HelpObject(); bool DeselectObject(); void DeleteAllObjects(); diff --git a/src/level/scene_conditions.cpp b/src/level/scene_conditions.cpp index b4cb886e..2228fba1 100644 --- a/src/level/scene_conditions.cpp +++ b/src/level/scene_conditions.cpp @@ -19,10 +19,10 @@ #include "level/scene_conditions.h" -#include "math/geometry.h" - #include "level/parser/parserline.h" +#include "math/geometry.h" + #include "object/object.h" #include "object/object_manager.h" diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index 29d7d240..6c72d67f 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -32,12 +32,12 @@ #include "object/old_object.h" +#include "sound/sound.h" + #include "ui/controls/gauge.h" #include "ui/controls/interface.h" #include "ui/controls/window.h" -#include "sound/sound.h" - // Object's constructor. @@ -372,9 +372,9 @@ bool CAuto::GetBusy() return m_bBusy; } -void CAuto::SetBusy(bool bBusy) +void CAuto::SetBusy(bool busy) { - m_bBusy = bBusy; + m_bBusy = busy; } void CAuto::InitProgressTotal(float total) diff --git a/src/object/auto/auto.h b/src/object/auto/auto.h index c685e261..b3df5b9a 100644 --- a/src/object/auto/auto.h +++ b/src/object/auto/auto.h @@ -19,9 +19,8 @@ #pragma once - -#include "common/event.h" #include "common/error.h" +#include "common/event.h" #include "object/object_type.h" @@ -75,7 +74,7 @@ public: virtual Error GetError(); virtual bool GetBusy(); - virtual void SetBusy(bool bBuse); + virtual void SetBusy(bool busy); virtual void InitProgressTotal(float total); virtual void EventProgress(float rTime); diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index cb9e8510..6e5061dc 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -41,8 +41,6 @@ #include "ui/controls/interface.h" #include "ui/controls/window.h" -#include "sound/sound.h" - const float BASE_LAND_TIME = 7.5f; // hard landing diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h index ab0cec8c..04ebc076 100644 --- a/src/object/auto/autobase.h +++ b/src/object/auto/autobase.h @@ -86,7 +86,7 @@ public: protected: void UpdateInterface(); - void FreezeCargo(bool bFreeze); + void FreezeCargo(bool freeze); void MoveCargo(); Error CheckCloseDoor(); void BeginTransit(); diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp index d1853e0a..e7803848 100644 --- a/src/object/auto/autoconvert.cpp +++ b/src/object/auto/autoconvert.cpp @@ -22,11 +22,11 @@ #include "common/make_unique.h" +#include "level/robotmain.h" + #include "level/parser/parserline.h" #include "level/parser/parserparam.h" -#include "level/robotmain.h" - #include "math/geometry.h" #include "object/object_manager.h" @@ -34,11 +34,11 @@ #include "object/interface/transportable_object.h" +#include "sound/sound.h" + #include "ui/controls/interface.h" #include "ui/controls/window.h" -#include "sound/sound.h" - // Object's constructor. diff --git a/src/object/auto/autoconvert.h b/src/object/auto/autoconvert.h index 15c94f00..ba0505ea 100644 --- a/src/object/auto/autoconvert.h +++ b/src/object/auto/autoconvert.h @@ -42,7 +42,7 @@ public: CAutoConvert(COldObject* object); ~CAutoConvert(); - void DeleteObject(bool bAll=false) override; + void DeleteObject(bool all=false) override; void Init() override; bool EventProcess(const Event &event) override; diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp index bc1ced20..ab4a22ef 100644 --- a/src/object/auto/autoderrick.cpp +++ b/src/object/auto/autoderrick.cpp @@ -37,8 +37,6 @@ #include "ui/controls/interface.h" #include "ui/controls/window.h" -#include "sound/sound.h" - const float DERRICK_DELAY = 10.0f; // duration of the extraction diff --git a/src/object/auto/autoderrick.h b/src/object/auto/autoderrick.h index ea7d23d3..08d2515b 100644 --- a/src/object/auto/autoderrick.h +++ b/src/object/auto/autoderrick.h @@ -42,7 +42,7 @@ public: CAutoDerrick(COldObject* object); ~CAutoDerrick(); - void DeleteObject(bool bAll=false) override; + void DeleteObject(bool all=false) override; void Init() override; bool EventProcess(const Event &event) override; diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index 24b8e162..66df64ee 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -37,8 +37,6 @@ #include "ui/controls/interface.h" #include "ui/controls/window.h" -#include "sound/sound.h" - #include diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp index 0c61b1d3..0aab0264 100644 --- a/src/object/auto/autoegg.cpp +++ b/src/object/auto/autoegg.cpp @@ -32,8 +32,8 @@ #include "object/object_manager.h" #include "object/old_object.h" -#include "object/interface/programmable_object.h" #include "object/interface/program_storage_object.h" +#include "object/interface/programmable_object.h" #include "object/interface/transportable_object.h" diff --git a/src/object/auto/autoegg.h b/src/object/auto/autoegg.h index 8a82e1a4..9c8e29da 100644 --- a/src/object/auto/autoegg.h +++ b/src/object/auto/autoegg.h @@ -42,7 +42,7 @@ public: CAutoEgg(COldObject* object); ~CAutoEgg(); - void DeleteObject(bool bAll=false) override; + void DeleteObject(bool all=false) override; void Init() override; void Start(int param) override; diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp index 952805ea..2c62fce3 100644 --- a/src/object/auto/autofactory.cpp +++ b/src/object/auto/autofactory.cpp @@ -22,20 +22,20 @@ #include "common/make_unique.h" -#include "math/geometry.h" - #include "level/robotmain.h" #include "level/parser/parser.h" #include "level/parser/parserline.h" #include "level/parser/parserparam.h" +#include "math/geometry.h" + #include "object/object_create_params.h" #include "object/object_manager.h" #include "object/old_object.h" -#include "object/interface/programmable_object.h" #include "object/interface/program_storage_object.h" +#include "object/interface/programmable_object.h" #include "object/interface/transportable_object.h" #include "physics/physics.h" diff --git a/src/object/auto/autofactory.h b/src/object/auto/autofactory.h index 5e339ff0..ead937fa 100644 --- a/src/object/auto/autofactory.h +++ b/src/object/auto/autofactory.h @@ -43,7 +43,7 @@ public: CAutoFactory(COldObject* object); ~CAutoFactory(); - void DeleteObject(bool bAll=false) override; + void DeleteObject(bool all=false) override; void Init() override; bool EventProcess(const Event &event) override; diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index b8e69921..550a82ab 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -35,11 +35,11 @@ #include "object/interface/powered_object.h" +#include "sound/sound.h" + #include "ui/controls/interface.h" #include "ui/controls/window.h" -#include "sound/sound.h" - const float LABO_DELAY = 20.0f; // duration of the analysis diff --git a/src/object/auto/autonest.h b/src/object/auto/autonest.h index 4eed1769..d516e223 100644 --- a/src/object/auto/autonest.h +++ b/src/object/auto/autonest.h @@ -39,7 +39,7 @@ public: CAutoNest(COldObject* object); ~CAutoNest(); - void DeleteObject(bool bAll=false) override; + void DeleteObject(bool all=false) override; void Init() override; bool EventProcess(const Event &event) override; diff --git a/src/object/auto/autonuclearplant.cpp b/src/object/auto/autonuclearplant.cpp index 15d0bb32..b034f4cf 100644 --- a/src/object/auto/autonuclearplant.cpp +++ b/src/object/auto/autonuclearplant.cpp @@ -22,13 +22,13 @@ #include "common/make_unique.h" -#include "math/geometry.h" - #include "level/robotmain.h" #include "level/parser/parserline.h" #include "level/parser/parserparam.h" +#include "math/geometry.h" + #include "object/object_manager.h" #include "object/old_object.h" diff --git a/src/object/auto/autonuclearplant.h b/src/object/auto/autonuclearplant.h index fc1e7804..5d8c4cd2 100644 --- a/src/object/auto/autonuclearplant.h +++ b/src/object/auto/autonuclearplant.h @@ -42,7 +42,7 @@ public: CAutoNuclearPlant(COldObject* object); ~CAutoNuclearPlant(); - void DeleteObject(bool bAll=false) override; + void DeleteObject(bool all=false) override; void Init() override; bool EventProcess(const Event &event) override; diff --git a/src/object/auto/autopowercaptor.cpp b/src/object/auto/autopowercaptor.cpp index 0779bcaf..55c83c1d 100644 --- a/src/object/auto/autopowercaptor.cpp +++ b/src/object/auto/autopowercaptor.cpp @@ -22,11 +22,11 @@ #include "common/make_unique.h" -#include "math/geometry.h" - #include "level/parser/parserline.h" #include "level/parser/parserparam.h" +#include "math/geometry.h" + #include "object/object_manager.h" #include "object/old_object.h" diff --git a/src/object/auto/autopowerplant.h b/src/object/auto/autopowerplant.h index dbc4f3ef..92e700ec 100644 --- a/src/object/auto/autopowerplant.h +++ b/src/object/auto/autopowerplant.h @@ -43,7 +43,7 @@ public: CAutoPowerPlant(COldObject* object); ~CAutoPowerPlant(); - void DeleteObject(bool bAll=false) override; + void DeleteObject(bool all=false) override; void Init() override; bool EventProcess(const Event &event) override; diff --git a/src/object/auto/autoresearch.h b/src/object/auto/autoresearch.h index 55a8d946..eaeae3de 100644 --- a/src/object/auto/autoresearch.h +++ b/src/object/auto/autoresearch.h @@ -42,7 +42,7 @@ public: void DeleteObject(bool bAll=false) override; void Init() override; - Error StartAction(int result) override; + Error StartAction(int param) override; bool EventProcess(const Event &event) override; Error GetError() override; diff --git a/src/object/implementation/program_storage_impl.cpp b/src/object/implementation/program_storage_impl.cpp index 11142742..2ef4e8cc 100644 --- a/src/object/implementation/program_storage_impl.cpp +++ b/src/object/implementation/program_storage_impl.cpp @@ -17,7 +17,7 @@ * along with this program. If not, see http://gnu.org/licenses */ -#include "object/implementation/programmable_impl.h" +#include "object/implementation/program_storage_impl.h" #include "common/global.h" #include "common/logger.h" diff --git a/src/object/implementation/programmable_impl.h b/src/object/implementation/programmable_impl.h index f92b3128..b8e3125c 100644 --- a/src/object/implementation/programmable_impl.h +++ b/src/object/implementation/programmable_impl.h @@ -19,12 +19,13 @@ #pragma once -#include "object/interface/interactive_object.h" #include "object/interface/programmable_object.h" -#include "object/interface/trace_drawing_object.h" #include "math/vector.h" +#include "object/interface/interactive_object.h" +#include "object/interface/trace_drawing_object.h" + #include class CObject; @@ -64,7 +65,7 @@ public: void TraceRecordStop() override; bool IsTraceRecord() override; - void SetActivity(bool bMode) override; + void SetActivity(bool activity) override; bool GetActivity() override; void SetCmdLine(unsigned int rank, float value); diff --git a/src/object/interface/trace_drawing_object.h b/src/object/interface/trace_drawing_object.h index a5be3fd6..ee8c52b3 100644 --- a/src/object/interface/trace_drawing_object.h +++ b/src/object/interface/trace_drawing_object.h @@ -53,9 +53,9 @@ enum class TraceColor Max, }; //! Convert TraceColor to a std::string -std::string TraceColorName(TraceColor c); +std::string TraceColorName(TraceColor color); //! Return Gfx::Color for this TraceColor constants -Gfx::Color TraceColorColor(TraceColor c); +Gfx::Color TraceColorColor(TraceColor color); /** * \class CTraceDrawingObject diff --git a/src/object/object.cpp b/src/object/object.cpp index 0a597749..85688796 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -23,13 +23,13 @@ #include "common/restext.h" #include "common/stringutils.h" +#include "graphics/model/model_crash_sphere.h" + #include "level/robotmain.h" #include "level/parser/parserline.h" #include "level/parser/parserparam.h" -#include "graphics/model/model_crash_sphere.h" - #include "script/scriptfunc.h" #include diff --git a/src/object/old_object.h b/src/object/old_object.h index a44458b4..152d870d 100644 --- a/src/object/old_object.h +++ b/src/object/old_object.h @@ -28,6 +28,11 @@ #include "object/object.h" +#include "object/implementation/power_container_impl.h" +#include "object/implementation/program_storage_impl.h" +#include "object/implementation/programmable_impl.h" +#include "object/implementation/task_executor_impl.h" + #include "object/interface/carrier_object.h" #include "object/interface/controllable_object.h" #include "object/interface/flying_object.h" @@ -44,11 +49,6 @@ #include "object/interface/trace_drawing_object.h" #include "object/interface/transportable_object.h" -#include "object/implementation/power_container_impl.h" -#include "object/implementation/program_storage_impl.h" -#include "object/implementation/programmable_impl.h" -#include "object/implementation/task_executor_impl.h" - // The father of all parts must always be the part number zero! const int OBJECTMAXPART = 40; @@ -101,7 +101,7 @@ protected: void SetMovable(std::unique_ptr motion, std::unique_ptr physics); void SetAuto(std::unique_ptr automat); void SetOption(int option); - void SetJostlingSphere(const Math::Sphere& sphere); + void SetJostlingSphere(const Math::Sphere& jostlingSphere); public: @@ -360,7 +360,6 @@ protected: float m_cameraDist; bool m_bCameraLock; float m_magnifyDamage; - float m_param; Math::Sphere m_jostlingSphere; float m_shieldRadius; diff --git a/src/object/subclass/base_alien.cpp b/src/object/subclass/base_alien.cpp index 796d0dc1..350fd800 100644 --- a/src/object/subclass/base_alien.cpp +++ b/src/object/subclass/base_alien.cpp @@ -24,8 +24,6 @@ #include "level/parser/parserline.h" #include "level/parser/parserparam.h" -#include "graphics/engine/oldmodelmanager.h" - #include "object/object_create_params.h" #include "object/motion/motionant.h" @@ -87,7 +85,7 @@ std::unique_ptr CBaseAlien::Create( obj->SetProgrammable(); obj->SetMovable(std::move(motion), std::move(physics)); - return std::move(obj); + return obj; } void CBaseAlien::SetFixed(bool fixed) diff --git a/src/object/subclass/base_building.cpp b/src/object/subclass/base_building.cpp index 6f1a09a6..3a5700a6 100644 --- a/src/object/subclass/base_building.cpp +++ b/src/object/subclass/base_building.cpp @@ -889,5 +889,5 @@ std::unique_ptr CBaseBuilding::Create( obj->UpdateMapping(); - return std::move(obj); + return obj; } diff --git a/src/object/subclass/base_robot.cpp b/src/object/subclass/base_robot.cpp index 53423f08..7cf23c5e 100644 --- a/src/object/subclass/base_robot.cpp +++ b/src/object/subclass/base_robot.cpp @@ -55,7 +55,7 @@ std::unique_ptr CBaseRobot::Create( auto motion = MakeUnique(obj.get()); motion->Create(params.pos, params.angle, params.type, 1.0f, modelManager); obj->SetMovable(std::move(motion), nullptr); - return std::move(obj); + return obj; } if ( params.type == OBJECT_HUMAN || @@ -95,5 +95,5 @@ std::unique_ptr CBaseRobot::Create( obj->SetProgrammable(); obj->SetMovable(std::move(motion), std::move(physics)); - return std::move(obj); + return obj; } diff --git a/src/object/subclass/shielder.cpp b/src/object/subclass/shielder.cpp index 9b74ad55..df5f4a78 100644 --- a/src/object/subclass/shielder.cpp +++ b/src/object/subclass/shielder.cpp @@ -66,7 +66,7 @@ std::unique_ptr CShielder::Create( obj->SetProgrammable(); obj->SetMovable(std::move(motion), std::move(physics)); - return std::move(obj); + return obj; } void CShielder::SetShieldRadius(float shieldRadius) diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 455e82d5..49484d32 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -20,8 +20,8 @@ #include "object/task/taskgoto.h" -#include "common/global.h" #include "common/event.h" +#include "common/global.h" #include "common/make_unique.h" #include "graphics/engine/terrain.h" diff --git a/src/object/task/taskpen.h b/src/object/task/taskpen.h index 08de3610..525a298e 100644 --- a/src/object/task/taskpen.h +++ b/src/object/task/taskpen.h @@ -19,13 +19,12 @@ #pragma once - #include "object/task/task.h" -#include "object/interface/trace_drawing_object.h" - #include "math/vector.h" +#include "object/interface/trace_drawing_object.h" + enum TaskPenPhase { diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index f761dba8..f1adf4ab 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -23,10 +23,10 @@ #include "graphics/engine/pyro_manager.h" #include "graphics/engine/terrain.h" -#include "math/geometry.h" - #include "level/robotmain.h" +#include "math/geometry.h" + #include "object/object_manager.h" #include "object/old_object.h" diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index 4a0214a9..3b55bb23 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -3680,14 +3680,14 @@ void CScriptFunctions::Init() CBotClass* bc; // Add the class Point. - bc = new CBotClass("point", nullptr, true); // intrinsic class + bc = CBotClass::Create("point", nullptr, true); // intrinsic class bc->AddItem("x", CBotTypFloat); bc->AddItem("y", CBotTypFloat); bc->AddItem("z", CBotTypFloat); bc->AddFunction("point", CScriptFunctions::rPointConstructor, CScriptFunctions::cPointConstructor); // Adds the class Object. - bc = new CBotClass("object", nullptr); + bc = CBotClass::Create("object", nullptr); bc->AddItem("category", CBotTypResult(CBotTypInt), PR_READ); bc->AddItem("position", CBotTypResult(CBotTypClass, "point"), PR_READ); bc->AddItem("orientation", CBotTypResult(CBotTypFloat), PR_READ); @@ -3718,7 +3718,7 @@ void CScriptFunctions::Init() // canal.close(); // close the file // create the class FILE - bc = new CBotClass("file", nullptr); + bc = CBotClass::Create("file", nullptr); // adds the component ".filename" bc->AddItem("filename", CBotTypString); // adds the component ".handle" @@ -3991,6 +3991,6 @@ void CScriptFunctions::DestroyObjectVar(CBotVar* botVar, bool permanent) if ( botVar == nullptr ) return; botVar->SetUserPtr(OBJECTDELETED); - if(permanent) - delete botVar; + if (permanent) + CBotVar::Destroy(botVar); } diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp index 029327cf..a94e279c 100644 --- a/src/sound/oalsound/alsound.cpp +++ b/src/sound/oalsound/alsound.cpp @@ -27,7 +27,7 @@ #include -ALSound::ALSound() +CALSound::CALSound() : m_enabled(false), m_audioVolume(1.0f), m_musicVolume(1.0f), @@ -37,14 +37,12 @@ ALSound::ALSound() { } - -ALSound::~ALSound() +CALSound::~CALSound() { CleanUp(); } - -void ALSound::CleanUp() +void CALSound::CleanUp() { if (m_enabled) { @@ -71,8 +69,7 @@ void ALSound::CleanUp() } } - -bool ALSound::Create() +bool CALSound::Create() { CleanUp(); @@ -102,20 +99,17 @@ bool ALSound::Create() return true; } - -bool ALSound::GetEnable() +bool CALSound::GetEnable() { return m_enabled; } - -void ALSound::SetAudioVolume(int volume) +void CALSound::SetAudioVolume(int volume) { m_audioVolume = static_cast(volume) / MAXVOLUME; } - -int ALSound::GetAudioVolume() +int CALSound::GetAudioVolume() { if ( !m_enabled ) return 0; @@ -123,8 +117,7 @@ int ALSound::GetAudioVolume() return m_audioVolume * MAXVOLUME; } - -void ALSound::SetMusicVolume(int volume) +void CALSound::SetMusicVolume(int volume) { m_musicVolume = static_cast(volume) / MAXVOLUME; if (m_currentMusic) @@ -133,8 +126,7 @@ void ALSound::SetMusicVolume(int volume) } } - -int ALSound::GetMusicVolume() +int CALSound::GetMusicVolume() { if ( !m_enabled ) return 0.0f; @@ -142,10 +134,9 @@ int ALSound::GetMusicVolume() return m_musicVolume * MAXVOLUME; } - -bool ALSound::Cache(SoundType sound, const std::string &filename) +bool CALSound::Cache(SoundType sound, const std::string &filename) { - auto buffer = MakeUnique(); + auto buffer = MakeUnique(); if (buffer->LoadFromFile(filename, sound)) { m_sounds[sound] = std::move(buffer); @@ -154,11 +145,11 @@ bool ALSound::Cache(SoundType sound, const std::string &filename) return false; } -bool ALSound::CacheMusic(const std::string &filename) +bool CALSound::CacheMusic(const std::string &filename) { if (m_music.find(filename) == m_music.end()) { - auto buffer = MakeUnique(); + auto buffer = MakeUnique(); if (buffer->LoadFromFile(filename, static_cast(-1))) { m_music[filename] = std::move(buffer); @@ -168,17 +159,17 @@ bool ALSound::CacheMusic(const std::string &filename) return false; } -bool ALSound::IsCached(SoundType sound) +bool CALSound::IsCached(SoundType sound) { return m_sounds.find(sound) != m_sounds.end(); } -bool ALSound::IsCachedMusic(const std::string &filename) +bool CALSound::IsCachedMusic(const std::string &filename) { return m_music.find(filename) != m_music.end(); } -int ALSound::GetPriority(SoundType sound) +int CALSound::GetPriority(SoundType sound) { if ( sound == SOUND_FLYh || sound == SOUND_FLY || @@ -226,8 +217,7 @@ int ALSound::GetPriority(SoundType sound) return 10; } - -bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoaded) +bool CALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoaded) { int priority = GetPriority(sound); @@ -253,7 +243,7 @@ bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoade // just add a new channel if we dont have any if (m_channels.size() == 0) { - auto chn = MakeUnique(); + auto chn = MakeUnique(); // check if we channel ready to play music, if not report error if (chn->IsReady()) { @@ -278,7 +268,7 @@ bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoade { if (m_channels.find(i) == m_channels.end()) { - auto chn = MakeUnique(); + auto chn = MakeUnique(); // check if channel is ready to play music, if not destroy it and seek free one if (chn->IsReady()) { @@ -321,14 +311,12 @@ bool ALSound::SearchFreeBuffer(SoundType sound, int &channel, bool &alreadyLoade return false; } - -int ALSound::Play(SoundType sound, float amplitude, float frequency, bool loop) +int CALSound::Play(SoundType sound, float amplitude, float frequency, bool loop) { return Play(sound, m_eye, amplitude, frequency, loop); } - -int ALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, float frequency, bool loop) +int CALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, float frequency, bool loop) { if (!m_enabled) { @@ -356,7 +344,7 @@ int ALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, flo } } - Channel* chn = m_channels[channel].get(); + CChannel* chn = m_channels[channel].get(); chn->SetPosition(pos); chn->SetVolumeAtrib(1.0f); @@ -382,8 +370,7 @@ int ALSound::Play(SoundType sound, const Math::Vector &pos, float amplitude, flo return channel | ((chn->GetId() & 0xffff) << 16); } - -bool ALSound::FlushEnvelope(int channel) +bool CALSound::FlushEnvelope(int channel) { if (!CheckChannel(channel)) { @@ -394,8 +381,7 @@ bool ALSound::FlushEnvelope(int channel) return true; } - -bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper) +bool CALSound::AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper) { if (!CheckChannel(channel)) { @@ -413,8 +399,7 @@ bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float t return true; } - -bool ALSound::Position(int channel, const Math::Vector &pos) +bool CALSound::Position(int channel, const Math::Vector &pos) { if (!CheckChannel(channel)) { @@ -425,8 +410,7 @@ bool ALSound::Position(int channel, const Math::Vector &pos) return true; } - -bool ALSound::Frequency(int channel, float frequency) +bool CALSound::Frequency(int channel, float frequency) { if (!CheckChannel(channel)) { @@ -438,7 +422,7 @@ bool ALSound::Frequency(int channel, float frequency) return true; } -bool ALSound::Stop(int channel) +bool CALSound::Stop(int channel) { if (!CheckChannel(channel)) { @@ -451,8 +435,7 @@ bool ALSound::Stop(int channel) return true; } - -bool ALSound::StopAll() +bool CALSound::StopAll() { if (!m_enabled) { @@ -468,8 +451,7 @@ bool ALSound::StopAll() return true; } - -bool ALSound::MuteAll(bool mute) +bool CALSound::MuteAll(bool mute) { if (!m_enabled) { @@ -487,8 +469,7 @@ bool ALSound::MuteAll(bool mute) return true; } - -void ALSound::FrameMove(float delta) +void CALSound::FrameMove(float rTime) { if (!m_enabled) { @@ -513,7 +494,7 @@ void ALSound::FrameMove(float delta) continue; SoundOper &oper = it.second->GetEnvelope(); - oper.currentTime += delta; + oper.currentTime += rTime; progress = oper.currentTime / oper.totalTime; progress = std::min(progress, 1.0f); @@ -560,7 +541,7 @@ void ALSound::FrameMove(float delta) } else { - it->currentTime += delta; + it->currentTime += rTime; it->music->SetVolume(((it->fadeTime-it->currentTime) / it->fadeTime) * m_musicVolume); ++it; } @@ -574,14 +555,13 @@ void ALSound::FrameMove(float delta) } else { - m_previousMusic.currentTime += delta; + m_previousMusic.currentTime += rTime; m_previousMusic.music->SetVolume(((m_previousMusic.fadeTime-m_previousMusic.currentTime) / m_previousMusic.fadeTime) * m_musicVolume); } } } - -void ALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat) +void CALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat) { m_eye = eye; m_lookat = lookat; @@ -593,15 +573,14 @@ void ALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat) alListenerfv(AL_ORIENTATION, orientation); } - -bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime) +bool CALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime) { if (!m_enabled) { return false; } - Buffer *buffer = nullptr; + CBuffer *buffer = nullptr; // check if we have music in cache if (m_music.find(filename) == m_music.end()) @@ -613,7 +592,7 @@ bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime return false; } */ - auto newBuffer = MakeUnique(); + auto newBuffer = MakeUnique(); buffer = newBuffer.get(); if (!newBuffer->LoadFromFile(filename, static_cast(-1))) { @@ -636,7 +615,7 @@ bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime m_oldMusic.push_back(std::move(old)); } - m_currentMusic = MakeUnique(); + m_currentMusic = MakeUnique(); m_currentMusic->SetBuffer(buffer); m_currentMusic->SetVolume(m_musicVolume); m_currentMusic->SetLoop(repeat); @@ -645,8 +624,7 @@ bool ALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTime return true; } - -bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat) +bool CALSound::PlayPauseMusic(const std::string &filename, bool repeat) { if (m_previousMusic.fadeTime > 0.0f) { @@ -671,8 +649,7 @@ bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat) return PlayMusic(filename, repeat); } - -void ALSound::StopPauseMusic() +void CALSound::StopPauseMusic() { if (m_previousMusic.fadeTime > 0.0f) { @@ -691,8 +668,7 @@ void ALSound::StopPauseMusic() } } - -bool ALSound::RestartMusic() +bool CALSound::RestartMusic() { if (!m_enabled || m_currentMusic == nullptr) { @@ -704,8 +680,7 @@ bool ALSound::RestartMusic() return true; } - -void ALSound::StopMusic(float fadeTime) +void CALSound::StopMusic(float fadeTime) { if (!m_enabled || m_currentMusic == nullptr) { @@ -719,8 +694,7 @@ void ALSound::StopMusic(float fadeTime) m_oldMusic.push_back(std::move(old)); } - -bool ALSound::IsPlayingMusic() +bool CALSound::IsPlayingMusic() { if (!m_enabled || m_currentMusic == nullptr) { @@ -730,8 +704,7 @@ bool ALSound::IsPlayingMusic() return m_currentMusic->IsPlaying(); } - -void ALSound::SuspendMusic() +void CALSound::SuspendMusic() { if (!m_enabled || m_currentMusic == nullptr) { @@ -741,8 +714,7 @@ void ALSound::SuspendMusic() m_currentMusic->Stop(); } - -bool ALSound::CheckChannel(int &channel) +bool CALSound::CheckChannel(int &channel) { int id = (channel >> 16) & 0xffff; channel &= 0xffff; diff --git a/src/sound/oalsound/alsound.h b/src/sound/oalsound/alsound.h index 39ad905b..a03a08db 100644 --- a/src/sound/oalsound/alsound.h +++ b/src/sound/oalsound/alsound.h @@ -60,7 +60,7 @@ struct OldMusic return *this; } - std::unique_ptr music; + std::unique_ptr music; float fadeTime = 0.0f; float currentTime = 0.0f; @@ -75,11 +75,11 @@ struct OldMusic } }; -class ALSound : public CSoundInterface +class CALSound : public CSoundInterface { public: - ALSound(); - ~ALSound(); + CALSound(); + ~CALSound(); bool Create() override; bool Cache(SoundType, const std::string &) override; @@ -126,10 +126,10 @@ private: unsigned int m_channelsLimit; ALCdevice* m_device; ALCcontext* m_context; - std::map> m_sounds; - std::map> m_music; - std::map> m_channels; - std::unique_ptr m_currentMusic; + std::map> m_sounds; + std::map> m_music; + std::map> m_channels; + std::unique_ptr m_currentMusic; std::list m_oldMusic; OldMusic m_previousMusic; Math::Vector m_eye; diff --git a/src/sound/oalsound/buffer.cpp b/src/sound/oalsound/buffer.cpp index 7f6b6700..c48da360 100644 --- a/src/sound/oalsound/buffer.cpp +++ b/src/sound/oalsound/buffer.cpp @@ -28,15 +28,14 @@ #include -Buffer::Buffer() +CBuffer::CBuffer() : m_buffer(), m_sound(), m_loaded(false), m_duration(0.0f) {} - -Buffer::~Buffer() +CBuffer::~CBuffer() { if (m_loaded) { @@ -46,8 +45,7 @@ Buffer::~Buffer() } } - -bool Buffer::LoadFromFile(std::string filename, SoundType sound) +bool CBuffer::LoadFromFile(std::string filename, SoundType sound) { m_sound = sound; GetLogger()->Debug("Loading audio file: %s\n", filename.c_str()); @@ -92,27 +90,22 @@ bool Buffer::LoadFromFile(std::string filename, SoundType sound) return true; } - -SoundType Buffer::GetSoundType() +SoundType CBuffer::GetSoundType() { return m_sound; } - -ALuint Buffer::GetBuffer() +ALuint CBuffer::GetBuffer() { return m_buffer; } - -bool Buffer::IsLoaded() +bool CBuffer::IsLoaded() { return m_loaded; } - -float Buffer::GetDuration() +float CBuffer::GetDuration() { return m_duration; } - diff --git a/src/sound/oalsound/buffer.h b/src/sound/oalsound/buffer.h index b45ce3bc..379fafb6 100644 --- a/src/sound/oalsound/buffer.h +++ b/src/sound/oalsound/buffer.h @@ -32,11 +32,11 @@ #include -class Buffer +class CBuffer { public: - Buffer(); - ~Buffer(); + CBuffer(); + ~CBuffer(); bool LoadFromFile(std::string, SoundType); bool IsLoaded(); diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp index 4b3b5593..fb506e42 100644 --- a/src/sound/oalsound/channel.cpp +++ b/src/sound/oalsound/channel.cpp @@ -22,7 +22,7 @@ #include "sound/oalsound/buffer.h" -Channel::Channel() +CChannel::CChannel() : m_buffer(nullptr), m_source(0), m_priority(0), @@ -49,8 +49,7 @@ Channel::Channel() } } - -Channel::~Channel() +CChannel::~CChannel() { if (m_ready) { @@ -62,8 +61,7 @@ Channel::~Channel() } } - -bool Channel::Play() +bool CChannel::Play() { if (!m_ready || m_buffer == nullptr) { @@ -81,7 +79,7 @@ bool Channel::Play() return true; } -bool Channel::Pause() +bool CChannel::Pause() { if (!m_ready || !IsPlaying()) { @@ -96,8 +94,7 @@ bool Channel::Pause() return true; } - -bool Channel::SetPosition(const Math::Vector &pos) +bool CChannel::SetPosition(const Math::Vector &pos) { if (!m_ready || m_buffer == nullptr) { @@ -113,8 +110,7 @@ bool Channel::SetPosition(const Math::Vector &pos) return true; } - -bool Channel::SetFrequency(float freq) +bool CChannel::SetFrequency(float freq) { if (!m_ready || m_buffer == nullptr) { @@ -130,8 +126,7 @@ bool Channel::SetFrequency(float freq) return true; } - -float Channel::GetFrequency() +float CChannel::GetFrequency() { ALfloat freq; if (!m_ready || m_buffer == nullptr) @@ -149,8 +144,7 @@ float Channel::GetFrequency() return freq; } - -bool Channel::SetVolume(float vol) +bool CChannel::SetVolume(float vol) { if (!m_ready || vol < 0 || m_buffer == nullptr) { @@ -166,8 +160,7 @@ bool Channel::SetVolume(float vol) return true; } - -float Channel::GetVolume() +float CChannel::GetVolume() { ALfloat vol; if (!m_ready || m_buffer == nullptr) @@ -185,87 +178,72 @@ float Channel::GetVolume() return vol; } - -void Channel::SetVolumeAtrib(float volume) +void CChannel::SetVolumeAtrib(float volume) { m_volume = volume; } - -float Channel::GetVolumeAtrib() +float CChannel::GetVolumeAtrib() { return m_volume; } - - -int Channel::GetPriority() +int CChannel::GetPriority() { return m_priority; } - -void Channel::SetPriority(int pri) +void CChannel::SetPriority(int pri) { m_priority = pri; } - -void Channel::SetStartAmplitude(float gain) +void CChannel::SetStartAmplitude(float gain) { m_startAmplitude = gain; } - -void Channel::SetStartFrequency(float freq) +void CChannel::SetStartFrequency(float freq) { m_startFrequency = freq; } - -void Channel::SetChangeFrequency(float freq) +void CChannel::SetChangeFrequency(float freq) { m_changeFrequency = freq; } - -float Channel::GetStartAmplitude() +float CChannel::GetStartAmplitude() { return m_startAmplitude; } - -float Channel::GetStartFrequency() +float CChannel::GetStartFrequency() { return m_startFrequency; } - -float Channel::GetChangeFrequency() +float CChannel::GetChangeFrequency() { return m_changeFrequency; } - -float Channel::GetInitFrequency() +float CChannel::GetInitFrequency() { return m_initFrequency; } - -void Channel::AddOper(SoundOper oper) +void CChannel::AddOper(SoundOper oper) { m_oper.push_back(oper); } - -void Channel::ResetOper() +void CChannel::ResetOper() { m_oper.clear(); } - -SoundType Channel::GetSoundType() +SoundType CChannel::GetSoundType() { if (!m_ready || m_buffer == nullptr) { @@ -275,8 +253,7 @@ SoundType Channel::GetSoundType() return m_buffer->GetSoundType(); } - -bool Channel::SetBuffer(Buffer *buffer) +bool CChannel::SetBuffer(CBuffer *buffer) { if (!m_ready) return false; @@ -299,7 +276,7 @@ bool Channel::SetBuffer(Buffer *buffer) return true; } -bool Channel::IsPlaying() +bool CChannel::IsPlaying() { ALint status; if (!m_ready || m_buffer == nullptr) @@ -317,19 +294,17 @@ bool Channel::IsPlaying() return status == AL_PLAYING; } - -bool Channel::IsReady() +bool CChannel::IsReady() { return m_ready; } -bool Channel::IsLoaded() +bool CChannel::IsLoaded() { return m_buffer != nullptr; } - -bool Channel::Stop() +bool CChannel::Stop() { if (!m_ready || m_buffer == nullptr) { @@ -345,8 +320,7 @@ bool Channel::Stop() return true; } - -float Channel::GetCurrentTime() +float CChannel::GetCurrentTime() { if (!m_ready || m_buffer == nullptr) { @@ -363,8 +337,7 @@ float Channel::GetCurrentTime() return current; } - -void Channel::SetCurrentTime(float current) +void CChannel::SetCurrentTime(float current) { if (!m_ready || m_buffer == nullptr) { @@ -378,8 +351,7 @@ void Channel::SetCurrentTime(float current) } } - -float Channel::GetDuration() +float CChannel::GetDuration() { if (!m_ready || m_buffer == nullptr) { @@ -389,50 +361,42 @@ float Channel::GetDuration() return m_buffer->GetDuration(); } - -bool Channel::HasEnvelope() +bool CChannel::HasEnvelope() { return m_oper.size() > 0; } - -SoundOper& Channel::GetEnvelope() +SoundOper& CChannel::GetEnvelope() { return m_oper.front(); } - -void Channel::PopEnvelope() +void CChannel::PopEnvelope() { m_oper.pop_front(); } - -void Channel::SetLoop(bool loop) +void CChannel::SetLoop(bool loop) { m_loop = loop; } - -void Channel::Mute(bool mute) +void CChannel::Mute(bool mute) { m_mute = mute; } - -bool Channel::IsMuted() +bool CChannel::IsMuted() { return m_mute; } - -void Channel::Reset() +void CChannel::Reset() { m_id++; } - -int Channel::GetId() +int CChannel::GetId() { return m_id; } diff --git a/src/sound/oalsound/channel.h b/src/sound/oalsound/channel.h index b6050062..63b4362a 100644 --- a/src/sound/oalsound/channel.h +++ b/src/sound/oalsound/channel.h @@ -37,7 +37,7 @@ #include #include -class Buffer; +class CBuffer; struct SoundOper { @@ -49,11 +49,11 @@ struct SoundOper }; -class Channel +class CChannel { public: - Channel(); - ~Channel(); + CChannel(); + ~CChannel(); bool Play(); bool Pause(); @@ -77,7 +77,7 @@ public: bool IsReady(); bool IsLoaded(); - bool SetBuffer(Buffer *buffer); + bool SetBuffer(CBuffer *buffer); bool HasEnvelope(); SoundOper& GetEnvelope(); @@ -106,7 +106,7 @@ public: int GetId(); private: - Buffer *m_buffer; + CBuffer *m_buffer; ALuint m_source; int m_priority; diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp index 7afe9568..fb10d2f4 100644 --- a/src/sound/sound.cpp +++ b/src/sound/sound.cpp @@ -153,7 +153,7 @@ bool CSoundInterface::StopAll() return true; } -bool CSoundInterface::MuteAll(bool bMute) +bool CSoundInterface::MuteAll(bool mute) { return true; } diff --git a/src/ui/controls/button.cpp b/src/ui/controls/button.cpp index 2f2a7b09..92ac3f5d 100644 --- a/src/ui/controls/button.cpp +++ b/src/ui/controls/button.cpp @@ -208,9 +208,9 @@ void CButton::Draw() // Management of immediate mode, which sends the event "press" // before the mouse button is released. -void CButton::SetImmediat(bool bImmediat) +void CButton::SetImmediat(bool immediat) { - m_bImmediat = bImmediat; + m_bImmediat = immediat; } bool CButton::GetImmediat() diff --git a/src/ui/controls/button.h b/src/ui/controls/button.h index c4cc7e81..a5966621 100644 --- a/src/ui/controls/button.h +++ b/src/ui/controls/button.h @@ -38,7 +38,7 @@ public: void Draw() override; - void SetImmediat(bool bRepeat); + void SetImmediat(bool immediat); bool GetImmediat(); void SetRepeat(bool bRepeat); diff --git a/src/ui/controls/list.cpp b/src/ui/controls/list.cpp index 7ed77b7e..be2301cd 100644 --- a/src/ui/controls/list.cpp +++ b/src/ui/controls/list.cpp @@ -699,12 +699,12 @@ bool CList::GetCheck(int i) // Specifies the bit "enable" for a box. -void CList::SetEnable(int i, bool bMode) +void CList::SetEnable(int i, bool enable) { if ( i < 0 || i >= m_totalLine ) return; - m_items[i].enable = bMode; + m_items[i].enable = enable; } // Returns the bit "enable" for a box. diff --git a/src/ui/controls/list.h b/src/ui/controls/list.h index abf90b22..82671c25 100644 --- a/src/ui/controls/list.h +++ b/src/ui/controls/list.h @@ -77,7 +77,7 @@ public: void SetCheck(int i, bool bMode); bool GetCheck(int i); - void SetEnable(int i, bool bEnable); + void SetEnable(int i, bool enable); bool GetEnable(int i); void SetTabs(int i, float pos, Gfx::TextAlign justif=Gfx::TEXT_ALIGN_LEFT); diff --git a/src/ui/controls/slider.h b/src/ui/controls/slider.h index ce2d5b47..ca35c13d 100644 --- a/src/ui/controls/slider.h +++ b/src/ui/controls/slider.h @@ -34,7 +34,7 @@ public: CSlider(); ~CSlider(); - bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) override; + bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) override; void SetPos(Math::Point pos) override; void SetDim(Math::Point dim) override; diff --git a/src/ui/controls/target.h b/src/ui/controls/target.h index b7d70494..4de48c1d 100644 --- a/src/ui/controls/target.h +++ b/src/ui/controls/target.h @@ -37,7 +37,7 @@ public: CTarget(); ~CTarget(); - bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) override; + bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) override; bool EventProcess(const Event &event) override; void Draw() override; diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h index 8db4e938..6c36607f 100644 --- a/src/ui/displaytext.h +++ b/src/ui/displaytext.h @@ -19,8 +19,8 @@ #pragma once -#include "common/event.h" #include "common/error.h" +#include "common/event.h" #include diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 31e5ebbb..662e0a2c 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -29,14 +29,14 @@ #include "common/make_unique.h" #include "common/settings.h" -#include "level/robotmain.h" #include "level/player_profile.h" +#include "level/robotmain.h" #include "sound/sound.h" #include "ui/controls/button.h" -#include "ui/controls/label.h" #include "ui/controls/interface.h" +#include "ui/controls/label.h" #include "ui/controls/window.h" #include "ui/screen/screen_setup.h" diff --git a/src/ui/mainui.cpp b/src/ui/mainui.cpp index c61dd033..2cc52979 100644 --- a/src/ui/mainui.cpp +++ b/src/ui/mainui.cpp @@ -35,6 +35,11 @@ #include "ui/maindialog.h" +#include "ui/controls/group.h" +#include "ui/controls/interface.h" +#include "ui/controls/label.h" +#include "ui/controls/window.h" + #include "ui/screen/screen.h" #include "ui/screen/screen_apperance.h" #include "ui/screen/screen_io_read.h" @@ -43,19 +48,14 @@ #include "ui/screen/screen_loading.h" #include "ui/screen/screen_main_menu.h" #include "ui/screen/screen_player_select.h" +#include "ui/screen/screen_quit.h" #include "ui/screen/screen_setup_controls.h" #include "ui/screen/screen_setup_display.h" #include "ui/screen/screen_setup_game.h" #include "ui/screen/screen_setup_graphics.h" #include "ui/screen/screen_setup_sound.h" -#include "ui/screen/screen_quit.h" #include "ui/screen/screen_welcome.h" -#include "ui/controls/interface.h" -#include "ui/controls/group.h" -#include "ui/controls/label.h" -#include "ui/controls/window.h" - namespace Ui { diff --git a/src/ui/object_interface.h b/src/ui/object_interface.h index 7d892592..fb5d7919 100644 --- a/src/ui/object_interface.h +++ b/src/ui/object_interface.h @@ -53,7 +53,7 @@ public: CObjectInterface(COldObject* object); ~CObjectInterface(); - void DeleteObject(bool bAll=false); + void DeleteObject(bool all=false); bool EventProcess(const Event &event); bool CreateInterface(bool bSelect); diff --git a/src/ui/screen/screen.cpp b/src/ui/screen/screen.cpp index 7adc5df8..fce3a073 100644 --- a/src/ui/screen/screen.cpp +++ b/src/ui/screen/screen.cpp @@ -19,10 +19,10 @@ #include "ui/screen/screen.h" -#include "common/version.h" - #include "app/app.h" +#include "common/version.h" + #include "graphics/engine/engine.h" #include "level/robotmain.h" diff --git a/src/ui/screen/screen_io.cpp b/src/ui/screen/screen_io.cpp index fbae0483..450990f4 100644 --- a/src/ui/screen/screen_io.cpp +++ b/src/ui/screen/screen_io.cpp @@ -31,15 +31,15 @@ #include "sound/sound.h" -#include "ui/screen/screen_level_list.h" - #include "ui/controls/button.h" #include "ui/controls/edit.h" -#include "ui/controls/interface.h" #include "ui/controls/image.h" +#include "ui/controls/interface.h" #include "ui/controls/list.h" #include "ui/controls/window.h" +#include "ui/screen/screen_level_list.h" + #include #include diff --git a/src/ui/screen/screen_io_read.cpp b/src/ui/screen/screen_io_read.cpp index 5ce9753e..3fd4b6b9 100644 --- a/src/ui/screen/screen_io_read.cpp +++ b/src/ui/screen/screen_io_read.cpp @@ -26,8 +26,8 @@ #include "level/robotmain.h" #include "ui/controls/button.h" -#include "ui/controls/interface.h" #include "ui/controls/image.h" +#include "ui/controls/interface.h" #include "ui/controls/list.h" #include "ui/controls/window.h" diff --git a/src/ui/screen/screen_io_write.cpp b/src/ui/screen/screen_io_write.cpp index f5dcaca2..b372670b 100644 --- a/src/ui/screen/screen_io_write.cpp +++ b/src/ui/screen/screen_io_write.cpp @@ -27,8 +27,8 @@ #include "ui/controls/button.h" #include "ui/controls/edit.h" -#include "ui/controls/interface.h" #include "ui/controls/image.h" +#include "ui/controls/interface.h" #include "ui/controls/label.h" #include "ui/controls/list.h" #include "ui/controls/window.h" diff --git a/src/ui/screen/screen_player_select.cpp b/src/ui/screen/screen_player_select.cpp index 680af0c6..33aeaafd 100644 --- a/src/ui/screen/screen_player_select.cpp +++ b/src/ui/screen/screen_player_select.cpp @@ -21,13 +21,12 @@ #include "app/app.h" -#include "level/robotmain.h" - #include "common/logger.h" #include "common/misc.h" #include "common/stringutils.h" #include "level/player_profile.h" +#include "level/robotmain.h" #include "sound/sound.h" @@ -194,9 +193,13 @@ bool CScreenPlayerSelect::EventProcess(const Event &event) GetResource(RES_TEXT, RT_DIALOG_DELGAME, name); gamer = pl->GetItemName(pl->GetSelect()); - m_dialog->StartQuestion(StrUtils::Format(name.c_str(), gamer), true, false, false, [&]() { - NameDelete(); - }); + m_dialog->StartQuestion( + StrUtils::Format(name.c_str(), gamer), true, false, false, + [&]() + { + NameDelete(); + } + ); break; default: diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index b5da62f7..033e57e0 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -32,12 +32,12 @@ #include "common/resources/resourcemanager.h" -#include "level/robotmain.h" -#include "level/player_profile.h" - #include "graphics/engine/camera.h" #include "graphics/engine/engine.h" +#include "level/player_profile.h" +#include "level/robotmain.h" + #include "object/object.h" #include "object/interface/program_storage_object.h" diff --git a/test/unit/app/app_test.cpp b/test/unit/app/app_test.cpp index 3aec8eff..6075e7cb 100644 --- a/test/unit/app/app_test.cpp +++ b/test/unit/app/app_test.cpp @@ -61,16 +61,16 @@ public: } }; -class ApplicationUT : public testing::Test +class CApplicationUT : public testing::Test { protected: - ApplicationUT() : + CApplicationUT() : m_systemUtils(nullptr), m_stampUid(0), m_currentTime(0) {} - ~ApplicationUT() NOEXCEPT + ~CApplicationUT() NOEXCEPT {} void SetUp() override; @@ -99,7 +99,7 @@ private: long long m_currentTime; }; -void ApplicationUT::SetUp() +void CApplicationUT::SetUp() { m_systemUtils = m_mocks.Mock(); @@ -107,21 +107,21 @@ void ApplicationUT::SetUp() m_mocks.OnCall(m_systemUtils, CSystemUtils::GetLangPath).Return(""); m_mocks.OnCall(m_systemUtils, CSystemUtils::GetSaveDir).Return(""); - m_mocks.OnCall(m_systemUtils, CSystemUtils::CreateTimeStamp).Do(std::bind(&ApplicationUT::CreateTimeStamp, this)); - m_mocks.OnCall(m_systemUtils, CSystemUtils::DestroyTimeStamp).Do(std::bind(&ApplicationUT::DestroyTimeStamp, this, ph::_1)); - m_mocks.OnCall(m_systemUtils, CSystemUtils::CopyTimeStamp).Do(std::bind(&ApplicationUT::CopyTimeStamp, this, ph::_1, ph::_2)); - m_mocks.OnCall(m_systemUtils, CSystemUtils::GetCurrentTimeStamp).Do(std::bind(&ApplicationUT::GetCurrentTimeStamp, this, ph::_1)); - m_mocks.OnCall(m_systemUtils, CSystemUtils::TimeStampExactDiff).Do(std::bind(&ApplicationUT::TimeStampExactDiff, this, ph::_1, ph::_2)); + m_mocks.OnCall(m_systemUtils, CSystemUtils::CreateTimeStamp).Do(std::bind(&CApplicationUT::CreateTimeStamp, this)); + m_mocks.OnCall(m_systemUtils, CSystemUtils::DestroyTimeStamp).Do(std::bind(&CApplicationUT::DestroyTimeStamp, this, ph::_1)); + m_mocks.OnCall(m_systemUtils, CSystemUtils::CopyTimeStamp).Do(std::bind(&CApplicationUT::CopyTimeStamp, this, ph::_1, ph::_2)); + m_mocks.OnCall(m_systemUtils, CSystemUtils::GetCurrentTimeStamp).Do(std::bind(&CApplicationUT::GetCurrentTimeStamp, this, ph::_1)); + m_mocks.OnCall(m_systemUtils, CSystemUtils::TimeStampExactDiff).Do(std::bind(&CApplicationUT::TimeStampExactDiff, this, ph::_1, ph::_2)); m_app = MakeUnique(m_systemUtils); } -void ApplicationUT::TearDown() +void CApplicationUT::TearDown() { m_app.reset(); } -SystemTimeStamp* ApplicationUT::CreateTimeStamp() +SystemTimeStamp* CApplicationUT::CreateTimeStamp() { auto stamp = MakeUnique(++m_stampUid); auto stampPtr = stamp.get(); @@ -129,33 +129,33 @@ SystemTimeStamp* ApplicationUT::CreateTimeStamp() return stampPtr; } -void ApplicationUT::DestroyTimeStamp(SystemTimeStamp *stamp) +void CApplicationUT::DestroyTimeStamp(SystemTimeStamp *stamp) { } -void ApplicationUT::CopyTimeStamp(SystemTimeStamp *dst, SystemTimeStamp *src) +void CApplicationUT::CopyTimeStamp(SystemTimeStamp *dst, SystemTimeStamp *src) { *static_cast(dst) = *static_cast(src); } -void ApplicationUT::GetCurrentTimeStamp(SystemTimeStamp *stamp) +void CApplicationUT::GetCurrentTimeStamp(SystemTimeStamp *stamp) { static_cast(stamp)->time = m_currentTime; } -long long ApplicationUT::TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) +long long CApplicationUT::TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) { return static_cast(after)->time - static_cast(before)->time; } -void ApplicationUT::NextInstant(long long diff) +void CApplicationUT::NextInstant(long long diff) { m_currentTime += diff; } -void ApplicationUT::TestCreateUpdateEvent(long long relTimeExact, long long absTimeExact, - float relTime, float absTime, - long long relTimeReal, long long absTimeReal) +void CApplicationUT::TestCreateUpdateEvent(long long relTimeExact, long long absTimeExact, + float relTime, float absTime, + long long relTimeReal, long long absTimeReal) { Event event = m_app->CreateUpdateEvent(); EXPECT_EQ(EVENT_FRAME, event.type); @@ -169,14 +169,14 @@ void ApplicationUT::TestCreateUpdateEvent(long long relTimeExact, long long absT } -TEST_F(ApplicationUT, UpdateEventTimeCalculation_SimulationSuspended) +TEST_F(CApplicationUT, UpdateEventTimeCalculation_SimulationSuspended) { m_app->SuspendSimulation(); Event event = m_app->CreateUpdateEvent(); EXPECT_EQ(EVENT_NULL, event.type); } -TEST_F(ApplicationUT, UpdateEventTimeCalculation_NormalOperation) +TEST_F(CApplicationUT, UpdateEventTimeCalculation_NormalOperation) { // 1st update @@ -205,7 +205,7 @@ TEST_F(ApplicationUT, UpdateEventTimeCalculation_NormalOperation) TestCreateUpdateEvent(relTimeExact, absTimeExact, relTime, absTime, relTimeReal, absTimeReal); } -TEST_F(ApplicationUT, UpdateEventTimeCalculation_NegativeTimeOperation) +TEST_F(CApplicationUT, UpdateEventTimeCalculation_NegativeTimeOperation) { // 1st update @@ -228,7 +228,7 @@ TEST_F(ApplicationUT, UpdateEventTimeCalculation_NegativeTimeOperation) EXPECT_EQ(EVENT_NULL, event.type); } -TEST_F(ApplicationUT, UpdateEventTimeCalculation_ChangingSimulationSpeed) +TEST_F(CApplicationUT, UpdateEventTimeCalculation_ChangingSimulationSpeed) { m_app->SetSimulationSpeed(2.0f); @@ -287,7 +287,7 @@ TEST_F(ApplicationUT, UpdateEventTimeCalculation_ChangingSimulationSpeed) TestCreateUpdateEvent(relTimeExact, absTimeExact, relTime, absTime, relTimeReal, absTimeReal); } -TEST_F(ApplicationUT, UpdateEventTimeCalculation_SuspendingAndResumingSimulation) +TEST_F(CApplicationUT, UpdateEventTimeCalculation_SuspendingAndResumingSimulation) { // 1st update -- simulation enabled diff --git a/test/unit/app/system_linux_test.cpp b/test/unit/app/system_linux_test.cpp index 1bd6db14..02a85a31 100644 --- a/test/unit/app/system_linux_test.cpp +++ b/test/unit/app/system_linux_test.cpp @@ -22,7 +22,7 @@ #include -class SystemUtilsLinuxUT : public testing::Test +class CSystemUtilsLinuxUT : public testing::Test { protected: static const long long SEC = 1000000000; @@ -31,7 +31,7 @@ protected: }; -TEST_F(SystemUtilsLinuxUT, TimeStampDiff) +TEST_F(CSystemUtilsLinuxUT, TimeStampDiff) { SystemTimeStamp before, after; diff --git a/test/unit/app/system_windows_test.cpp b/test/unit/app/system_windows_test.cpp index a517f478..6398db01 100644 --- a/test/unit/app/system_windows_test.cpp +++ b/test/unit/app/system_windows_test.cpp @@ -31,7 +31,7 @@ public: } }; -class SystemUtilsWindowsUT : public testing::Test +class CSystemUtilsWindowsUT : public testing::Test { protected: static const long long SEC = 1000000000; @@ -39,7 +39,7 @@ protected: CSystemUtilsWindowsWrapper m_systemUtils; }; -TEST_F(SystemUtilsWindowsUT, TimeStampDiff) +TEST_F(CSystemUtilsWindowsUT, TimeStampDiff) { m_systemUtils.SetFrequency(SEC); diff --git a/test/unit/common/config_file_test.cpp b/test/unit/common/config_file_test.cpp index 9af7d8f3..6af0ffe0 100644 --- a/test/unit/common/config_file_test.cpp +++ b/test/unit/common/config_file_test.cpp @@ -17,9 +17,10 @@ * along with this program. If not, see http://gnu.org/licenses */ +#include "app/system.h" + #include "common/config_file.h" #include "common/logger.h" -#include "app/system.h" #include #include diff --git a/test/unit/graphics/engine/lightman_test.cpp b/test/unit/graphics/engine/lightman_test.cpp index 06ba4ec4..dcddc0a0 100644 --- a/test/unit/graphics/engine/lightman_test.cpp +++ b/test/unit/graphics/engine/lightman_test.cpp @@ -17,12 +17,12 @@ * along with this program. If not, see http://gnu.org/licenses */ -#include "graphics/engine/lightman.h" - #include "common/make_unique.h" #include "graphics/core/device.h" +#include "graphics/engine/lightman.h" + #include #include @@ -33,15 +33,15 @@ using namespace Gfx; using namespace HippoMocks; namespace ph = std::placeholders; -class LightManagerUT : public testing::Test +class CLightManagerUT : public testing::Test { protected: - LightManagerUT() : + CLightManagerUT() : m_engine(nullptr), m_device(nullptr), m_maxLightsCount(0) {} - ~LightManagerUT() NOEXCEPT + ~CLightManagerUT() NOEXCEPT {} void SetUp() override; @@ -64,7 +64,7 @@ private: int m_maxLightsCount; }; -void LightManagerUT::SetUp() +void CLightManagerUT::SetUp() { m_engine = m_mocks.Mock(); m_device = m_mocks.Mock(); @@ -72,7 +72,7 @@ void LightManagerUT::SetUp() m_lightManager = MakeUnique(m_engine); } -void LightManagerUT::PrepareLightTesting(int maxLights, Math::Vector eyePos) +void CLightManagerUT::PrepareLightTesting(int maxLights, Math::Vector eyePos) { m_maxLightsCount = maxLights; @@ -80,12 +80,12 @@ void LightManagerUT::PrepareLightTesting(int maxLights, Math::Vector eyePos) m_lightManager->SetDevice(m_device); - m_mocks.OnCall(m_device, CDevice::SetLight).Do(std::bind(&LightManagerUT::CheckLight, this, ph::_1, ph::_2)); + m_mocks.OnCall(m_device, CDevice::SetLight).Do(std::bind(&CLightManagerUT::CheckLight, this, ph::_1, ph::_2)); m_mocks.OnCall(m_engine, CEngine::GetEyePt).Return(eyePos); } -void LightManagerUT::CheckLightSorting(EngineObjectType objectType, const std::vector& expectedLights) +void CLightManagerUT::CheckLightSorting(EngineObjectType objectType, const std::vector& expectedLights) { m_expectedLightTypes = expectedLights; @@ -105,14 +105,14 @@ void LightManagerUT::CheckLightSorting(EngineObjectType objectType, const std::v m_lightManager->UpdateDeviceLights(objectType); } -void LightManagerUT::CheckLight(int index, const Light& light) +void CLightManagerUT::CheckLight(int index, const Light& light) { ASSERT_TRUE(index >= 0 && index < static_cast( m_expectedLightTypes.size() )); ASSERT_EQ(m_expectedLightTypes[index], light.type); } -void LightManagerUT::AddLight(int type, LightPriority priority, bool used, bool enabled, - Math::Vector pos, EngineObjectType includeType, EngineObjectType excludeType) +void CLightManagerUT::AddLight(int type, LightPriority priority, bool used, bool enabled, + Math::Vector pos, EngineObjectType includeType, EngineObjectType excludeType) { int rank = m_lightManager->CreateLight(priority); @@ -129,7 +129,7 @@ void LightManagerUT::AddLight(int type, LightPriority priority, bool used, bool m_lightManager->DeleteLight(rank); } -TEST_F(LightManagerUT, LightSorting_UnusedOrDisabledAreSkipped) +TEST_F(CLightManagerUT, LightSorting_UnusedOrDisabledAreSkipped) { const int lightCount = 10; const Math::Vector eyePos(0.0f, 0.0f, 0.0f); @@ -143,7 +143,7 @@ TEST_F(LightManagerUT, LightSorting_UnusedOrDisabledAreSkipped) CheckLightSorting(ENG_OBJTYPE_TERRAIN, expectedLights); } -TEST_F(LightManagerUT, LightSorting_IncludeTypesAreIncluded) +TEST_F(CLightManagerUT, LightSorting_IncludeTypesAreIncluded) { const int lightCount = 10; const Math::Vector eyePos(0.0f, 0.0f, 0.0f); @@ -157,7 +157,7 @@ TEST_F(LightManagerUT, LightSorting_IncludeTypesAreIncluded) CheckLightSorting(ENG_OBJTYPE_TERRAIN, expectedLights); } -TEST_F(LightManagerUT, LightSorting_ExcludeTypesAreExcluded) +TEST_F(CLightManagerUT, LightSorting_ExcludeTypesAreExcluded) { const int lightCount = 10; const Math::Vector eyePos(0.0f, 0.0f, 0.0f); @@ -171,7 +171,7 @@ TEST_F(LightManagerUT, LightSorting_ExcludeTypesAreExcluded) CheckLightSorting(ENG_OBJTYPE_TERRAIN, expectedLights); } -TEST_F(LightManagerUT, LightSorting_SortingAccordingToDistance) +TEST_F(CLightManagerUT, LightSorting_SortingAccordingToDistance) { const int lightCount = 3; const Math::Vector eyePos(0.0f, 0.0f, 0.0f);