From e964d3e48c2b695fd2c0f1c88e2256d8922cb299 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 20 Apr 2018 01:31:11 +0200 Subject: [PATCH] Fix colobot-lint warnings --- src/common/settings.cpp | 1 + src/graphics/engine/engine.cpp | 1 + src/level/player_profile.cpp | 3 ++- src/level/robotmain.cpp | 15 +++++++++------ src/level/robotmain.h | 2 +- src/level/scoreboard.cpp | 4 ++-- src/level/scoreboard.h | 4 ++-- src/object/object_manager.h | 1 + src/object/old_object.cpp | 1 + src/script/scriptfunc.cpp | 6 +++--- src/ui/object_interface.cpp | 2 +- 11 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 3a84439c..93db8102 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -44,6 +44,7 @@ CSettings::CSettings() m_fontSize = 19.0f; m_windowPos = Math::Point(0.15f, 0.17f); m_windowDim = Math::Point(0.70f, 0.66f); + m_windowMax = false; m_IOPublic = false; m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f); diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 960d9d6d..e489b1e8 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -146,6 +146,7 @@ CEngine::CEngine(CApplication *app, CSystemUtils* systemUtils) m_showStats = false; m_focus = 0.75f; + m_hfov = 2.0f * atan((640.f/480.f) * tan(m_focus / 2.0f)); m_rankView = 0; diff --git a/src/level/player_profile.cpp b/src/level/player_profile.cpp index 971edd42..9abd20a8 100644 --- a/src/level/player_profile.cpp +++ b/src/level/player_profile.cpp @@ -518,7 +518,8 @@ void CPlayerProfile::LoadScene(std::string dir) CLevelParserLine* line = levelParser.Get("Mission"); cat = GetLevelCategoryFromDir(line->GetParam("base")->AsString()); - if (dir == "../../crashsave") LoadFinishedLevels(cat); + if (dir == "../../crashsave") + LoadFinishedLevels(cat); rank = line->GetParam("rank")->AsInt(); if (cat == LevelCategory::CustomLevels) diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp index 397652bb..b0706f24 100644 --- a/src/level/robotmain.cpp +++ b/src/level/robotmain.cpp @@ -221,6 +221,8 @@ CRobotMain::CRobotMain() m_resetCreate = false; m_shortCut = true; + m_commandHistoryIndex = -1; + m_movieInfoIndex = -1; m_tooltipPos = Math::Point(0.0f, 0.0f); @@ -4970,7 +4972,8 @@ Error CRobotMain::ProcessEndMissionTake() text, details, false, true, - [&]() { + [&]() + { ChangePhase(PHASE_WIN); } ); @@ -5564,13 +5567,13 @@ void CRobotMain::Autosave() void CRobotMain::QuickSave() { GetLogger()->Info("Quicksave!\n"); - + char infostr[100]; time_t now = time(nullptr); strftime(infostr, 99, "%y.%m.%d %H:%M", localtime(&now)); std::string info = std::string("[QUICKSAVE]") + infostr; std::string dir = m_playerProfile->GetSaveFile(std::string("quicksave")); - + m_playerProfile->SaveScene(dir, info); } @@ -5972,12 +5975,12 @@ bool CRobotMain::GetDebugCrashSpheres() return m_debugCrashSpheres; } -void CRobotMain::PushToCommandHistory(std::string str) +void CRobotMain::PushToCommandHistory(std::string cmd) { - if (!m_commandHistory.empty() && m_commandHistory.front() == str) // already in history + if (!m_commandHistory.empty() && m_commandHistory.front() == cmd) // already in history return; - m_commandHistory.push_front(str); + m_commandHistory.push_front(cmd); if (m_commandHistory.size() > 50) // to avoid infinite growth m_commandHistory.pop_back(); diff --git a/src/level/robotmain.h b/src/level/robotmain.h index 7fac6c2d..ce657372 100644 --- a/src/level/robotmain.h +++ b/src/level/robotmain.h @@ -528,7 +528,7 @@ protected: void UpdateDebugCrashSpheres(); //! Adds element to the beginning of command history - void PushToCommandHistory(std::string obj); + void PushToCommandHistory(std::string cmd); //! Returns next/previous element from command history and updates index //@{ std::string GetNextFromCommandHistory(); diff --git a/src/level/scoreboard.cpp b/src/level/scoreboard.cpp index 95bcc397..b574cf8b 100644 --- a/src/level/scoreboard.cpp +++ b/src/level/scoreboard.cpp @@ -22,10 +22,10 @@ #include "common/restext.h" #include "common/stringutils.h" -#include "level/parser/parserline.h" - #include "level/robotmain.h" +#include "level/parser/parserline.h" + #include "object/object.h" #include "ui/displaytext.h" diff --git a/src/level/scoreboard.h b/src/level/scoreboard.h index cb8b83b2..18cb67fb 100644 --- a/src/level/scoreboard.h +++ b/src/level/scoreboard.h @@ -115,11 +115,11 @@ public: void AddPoints(int team, int points); int GetScore(int team); - void SetScore(int team, int score); + void SetScore(int team, int points); private: std::vector> m_rulesKill = {}; std::vector> m_rulesEndTake = {}; std::map m_score; int m_finishCounter = 0; -}; \ No newline at end of file +}; diff --git a/src/object/object_manager.h b/src/object/object_manager.h index f5f3a16c..722812fa 100644 --- a/src/object/object_manager.h +++ b/src/object/object_manager.h @@ -32,6 +32,7 @@ #include "object/object_create_params.h" #include "object/object_interface_type.h" #include "object/object_type.h" + #include "object/interface/destroyable_object.h" #include diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp index 0a75854c..d8d15197 100644 --- a/src/object/old_object.cpp +++ b/src/object/old_object.cpp @@ -138,6 +138,7 @@ COldObject::COldObject(int id) m_virusTime = 0.0f; m_lastVirusParticle = 0.0f; m_damaging = false; + m_damageTime = 0.0f; m_dying = DeathType::Alive; m_bFlat = false; m_gunGoalV = 0.0f; diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index 9a65554c..de84c73a 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -591,7 +591,7 @@ bool CScriptFunctions::rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* resu } return true; } - + return true; } @@ -1315,7 +1315,7 @@ bool CScriptFunctions::rBuild(CBotVar* var, CBotVar* result, int& exception, voi } } } - result->SetValInt(err); // indicates the error or ok + result->SetValInt(err); // indicates the error or ok if ( err != ERR_OK ) { if ( script->m_errMode == ERM_STOP ) @@ -2464,7 +2464,7 @@ bool CScriptFunctions::rFire(CBotVar* var, CBotVar* result, int& exception, void if ( delay < 0.0f ) delay = -delay; err = script->m_taskExecutor->StartTaskFire(delay); } - result->SetValInt(err); // indicates the error or ok + result->SetValInt(err); // indicates the error or ok if ( err != ERR_OK ) { script->m_taskExecutor->StopForegroundTask(); diff --git a/src/ui/object_interface.cpp b/src/ui/object_interface.cpp index 8819068d..ab1fb088 100644 --- a/src/ui/object_interface.cpp +++ b/src/ui/object_interface.cpp @@ -1500,7 +1500,7 @@ void CObjectInterface::UpdateInterface(float rTime) m_lastAlarmTime = 0.0f; } } - + pg->SetLevel(shield); pg->SetIcon(icon); }