diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics/engine/lightman.cpp | 10 | ||||
-rw-r--r-- | src/graphics/engine/lightman.h | 18 | ||||
-rw-r--r-- | src/object/robotmain.cpp | 10 | ||||
-rw-r--r-- | src/script/script.cpp | 10 | ||||
-rw-r--r-- | src/ui/interface.cpp | 26 |
5 files changed, 37 insertions, 37 deletions
diff --git a/src/graphics/engine/lightman.cpp b/src/graphics/engine/lightman.cpp index 8694c7a..564cced 100644 --- a/src/graphics/engine/lightman.cpp +++ b/src/graphics/engine/lightman.cpp @@ -69,16 +69,6 @@ void LightProgression::SetTarget(float value) } -DynamicLight::DynamicLight() -{ - rank = 0; - used = enabled = false; - priority = LIGHT_PRI_LOW; - includeType = excludeType = ENG_OBJTYPE_NULL; -} - - - CLightManager::CLightManager(CEngine* engine) { m_device = nullptr; diff --git a/src/graphics/engine/lightman.h b/src/graphics/engine/lightman.h index a2f6044..5df466d 100644 --- a/src/graphics/engine/lightman.h +++ b/src/graphics/engine/lightman.h @@ -51,9 +51,12 @@ struct LightProgression float speed; LightProgression() - { - starting = ending = current = progress = speed = 0.0f; - } + : starting(0.0f) + , ending(0.0f) + , current(0.0f) + , progress(0.0f) + , speed(0.0f) + {} //! Initializes the progression void Init(float value); @@ -113,7 +116,14 @@ struct DynamicLight //! Type of objects excluded from lighting with this light; if ENG_OBJTYPE_NULL is used, it is ignored EngineObjectType excludeType; - DynamicLight(); + DynamicLight() + : rank(0) + , used(false) + , enabled(false) + , priority(LIGHT_PRI_LOW) + , includeType(ENG_OBJTYPE_NULL) + , excludeType(ENG_OBJTYPE_NULL) + {} }; /** diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index ddee0ff..1748c57 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -107,7 +107,7 @@ float g_unit; // conversion factor // Static variables static CBotClass* m_pClassFILE; -static CBotProgram* m_pFuncFile; +//static CBotProgram* m_pFuncFile; static int m_CompteurFileOpen = 0; static std::string m_filesDir; @@ -503,10 +503,10 @@ void InitClassFILE() m_pClassFILE->AddFunction("readln", rfread, cfread ); m_pClassFILE->AddFunction("eof", rfeof, cfeof ); - m_pFuncFile = new CBotProgram( ); - CBotStringArray ListFonctions; - m_pFuncFile->Compile( "public file openfile(string name, string mode) {return new file(name, mode);}", ListFonctions); - m_pFuncFile->SetIdent(-2); // restoreState in special identifier for this function + //m_pFuncFile = new CBotProgram( ); + //CBotStringArray ListFonctions; + //m_pFuncFile->Compile( "public file openfile(string name, string mode) {return new file(name, mode);}", ListFonctions); + //m_pFuncFile->SetIdent(-2); // restoreState in special identifier for this function } diff --git a/src/script/script.cpp b/src/script/script.cpp index 8736f01..ca6ce25 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -3689,6 +3689,7 @@ bool CScript::IsEmpty() bool CScript::CheckToken() { CBotToken* bt; + CBotToken* allBt; CBotString bs; const char* token; int error, cursor1, cursor2, i; @@ -3706,7 +3707,8 @@ bool CScript::CheckToken() used[i] = 0; // token not used } - bt = CBotToken::CompileTokens(m_script, error); + allBt = CBotToken::CompileTokens(m_script, error); + bt = allBt; while ( bt != 0 ) { bs = bt->GetString(); @@ -3727,7 +3729,7 @@ bool CScript::CheckToken() m_cursor1 = cursor1; m_cursor2 = cursor2; strcpy(m_title, "<erreur>"); - CBotToken::Delete(bt); + CBotToken::Delete(allBt); return false; } @@ -3742,12 +3744,12 @@ bool CScript::CheckToken() strcpy(m_token, m_main->GetObligatoryToken(i)); m_error = ERR_OBLIGATORYTOKEN; strcpy(m_title, "<erreur>"); - CBotToken::Delete(bt); + CBotToken::Delete(allBt); return false; } } - CBotToken::Delete(bt); + CBotToken::Delete(allBt); return true; } diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 845579e..ab2c01b 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -29,7 +29,7 @@ CInterface::CInterface() m_engine = Gfx::CEngine::GetInstancePointer(); m_camera = nullptr; - for (int i = 0; i < MAXCONTROL; i++ ) + for (int i = 0; i < MAXCONTROL; i++) { m_table[i] = nullptr; } @@ -47,9 +47,9 @@ CInterface::~CInterface() void CInterface::Flush() { - for (int i = 0; i < MAXCONTROL; i++ ) + for (int i = 0; i < MAXCONTROL; i++) { - if ( m_table[i] != nullptr ) + if (m_table[i] != nullptr) { delete m_table[i]; m_table[i] = nullptr; @@ -71,16 +71,15 @@ int CInterface::GetNextFreeControl() template <typename T> inline T* CInterface::CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) { - T* pc; - int index; if (eventMsg == EVENT_NULL) eventMsg = GetUniqueEventType(); - if ((index = GetNextFreeControl()) < 0) + int index = GetNextFreeControl(); + if (index < 0) return nullptr; m_table[index] = new T(); - pc = static_cast<T *>(m_table[index]); + T* pc = static_cast<T *>(m_table[index]); pc->Create(pos, dim, icon, eventMsg); return pc; } @@ -90,11 +89,10 @@ template <typename T> inline T* CInterface::CreateControl(Math::Point pos, Math: CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) { - CWindow* pc; - int index; if (eventMsg == EVENT_NULL) eventMsg = GetUniqueEventType(); + int index = -1; switch (eventMsg) { case EVENT_WINDOW0: index = 0; break; @@ -114,8 +112,9 @@ CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, E if (index < 0) return nullptr; + delete m_table[index]; m_table[index] = new CWindow(); - pc = static_cast<CWindow *>(m_table[index]); + CWindow* pc = static_cast<CWindow *>(m_table[index]); pc->Create(pos, dim, icon, eventMsg); return pc; } @@ -207,16 +206,15 @@ CSlider* CInterface::CreateSlider(Math::Point pos, Math::Point dim, int icon, Ev CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand) { - CList* pc; - int index; if (eventMsg == EVENT_NULL) eventMsg = GetUniqueEventType(); - if ((index = GetNextFreeControl()) < 0) + int index = GetNextFreeControl(); + if (index < 0) return nullptr; m_table[index] = new CList(); - pc = static_cast<CList *>(m_table[index]); + CList* pc = static_cast<CList *>(m_table[index]); pc->Create(pos, dim, icon, eventMsg, expand); return pc; } |