diff options
Diffstat (limited to 'src/object/auto/autodestroyer.cpp')
-rw-r--r-- | src/object/auto/autodestroyer.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index b40c374..740f600 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -1,5 +1,6 @@ // * This file is part of the COLOBOT source code // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * Copyright (C) 2012 Polish Portal of Colobot (PPC) // * // * This program is free software: you can redistribute it and/or modify // * it under the terms of the GNU General Public License as published by @@ -15,8 +16,6 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. -#include <stdio.h> - #include "object/auto/autodestroyer.h" #include "common/iman.h" @@ -24,7 +23,8 @@ #include "ui/interface.h" #include "ui/window.h" - +#include <stdio.h> +#include <string.h> // Object's constructor. @@ -61,7 +61,7 @@ void CAutoDestroyer::Init() m_time = 0.0f; m_timeVirus = 0.0f; - m_lastParticule = 0.0f; + m_lastParticle = 0.0f; CAuto::Init(); } @@ -72,19 +72,19 @@ void CAutoDestroyer::Init() bool CAutoDestroyer::EventProcess(const Event &event) { CObject* scrap; - CPyro* pyro; + Gfx::CPyro* pyro; Math::Vector pos, speed; Math::Point dim; CAuto::EventProcess(event); - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; m_progress += event.rTime*m_speed; m_timeVirus -= event.rTime; - if ( m_object->RetVirusMode() ) // contaminated by a virus? + if ( m_object->GetVirusMode() ) // contaminated by a virus? { if ( m_timeVirus <= 0.0f ) { @@ -117,7 +117,7 @@ bool CAutoDestroyer::EventProcess(const Event &event) } else { - m_sound->Play(SOUND_PSHHH2, m_object->RetPosition(0), 1.0f, 1.0f); + m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f); m_phase = ADEP_DOWN; m_progress = 0.0f; @@ -133,10 +133,10 @@ bool CAutoDestroyer::EventProcess(const Event &event) if ( m_progress >= 0.3f-0.05f && !m_bExplo ) { scrap = SearchPlastic(); - if ( scrap != 0 ) + if ( scrap != nullptr ) { - pyro = new CPyro(m_iMan); - pyro->Create(PT_FRAGT, scrap); + pyro = new Gfx::CPyro(m_iMan); + pyro->Create(Gfx::PT_FRAGT, scrap); } m_bExplo = true; } @@ -150,7 +150,7 @@ bool CAutoDestroyer::EventProcess(const Event &event) else { m_object->SetPosition(1, Math::Vector(0.0f, -10.0f, 0.0f)); - m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0)); + m_sound->Play(SOUND_REPAIR, m_object->GetPosition(0)); m_phase = ADEP_REPAIR; m_progress = 0.0f; @@ -165,7 +165,7 @@ bool CAutoDestroyer::EventProcess(const Event &event) } else { - m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 0.8f); + m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 0.8f); m_phase = ADEP_UP; m_progress = 0.0f; @@ -199,7 +199,7 @@ bool CAutoDestroyer::EventProcess(const Event &event) bool CAutoDestroyer::CreateInterface(bool bSelect) { - CWindow* pw; + Ui::CWindow* pw; Math::Point pos, ddim; float ox, oy, sx, sy; @@ -207,8 +207,8 @@ bool CAutoDestroyer::CreateInterface(bool bSelect) if ( !bSelect ) return true; - pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0); - if ( pw == 0 ) return false; + pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); + if ( pw == nullptr ) return false; ox = 3.0f/640.0f; oy = 3.0f/480.0f; @@ -235,23 +235,23 @@ CObject* CAutoDestroyer::SearchPlastic() float dist; int i; - sPos = m_object->RetPosition(0); + sPos = m_object->GetPosition(0); for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); - if ( pObj == 0 ) break; + pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i)); + if ( pObj == nullptr ) break; - type = pObj->RetType(); + type = pObj->GetType(); if ( type != OBJECT_SCRAP4 && type != OBJECT_SCRAP5 ) continue; - oPos = pObj->RetPosition(0); + oPos = pObj->GetPosition(0); dist = Math::Distance(oPos, sPos); if ( dist <= 5.0f ) return pObj; } - return 0; + return nullptr; } // Seeks if one vehicle is too close. @@ -264,14 +264,14 @@ bool CAutoDestroyer::SearchVehicle() float oRadius, dist; int i; - cPos = m_object->RetPosition(0); + cPos = m_object->GetPosition(0); for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); - if ( pObj == 0 ) break; + pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i)); + if ( pObj == nullptr ) break; - type = pObj->RetType(); + type = pObj->GetType(); if ( type != OBJECT_HUMAN && type != OBJECT_MOBILEfa && type != OBJECT_MOBILEta && @@ -316,11 +316,11 @@ bool CAutoDestroyer::SearchVehicle() } -// Returns an error due the state of the automation. +// Geturns an error due the state of the automation. -Error CAutoDestroyer::RetError() +Error CAutoDestroyer::GetError() { - if ( m_object->RetVirusMode() ) + if ( m_object->GetVirusMode() ) { return ERR_BAT_VIRUS; } @@ -362,11 +362,11 @@ bool CAutoDestroyer::Read(char *line) CAuto::Read(line); - m_phase = (AutoDestroyerPhase)OpInt(line, "aPhase", ADEP_WAIT); + m_phase = static_cast< AutoDestroyerPhase >(OpInt(line, "aPhase", ADEP_WAIT)); m_progress = OpFloat(line, "aProgress", 0.0f); m_speed = OpFloat(line, "aSpeed", 1.0f); - m_lastParticule = 0.0f; + m_lastParticle = 0.0f; return true; } |