[colobot] 20/377: Fix colobot-lint issues in restored code
Didier Raboud
odyx at moszumanska.debian.org
Wed Mar 30 13:33:53 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 94b3f8298827d8474cc3f6a509055050d1207d1e
Author: Piotr Dziwinski <piotrdz at gmail.com>
Date: Tue Sep 29 20:55:51 2015 +0200
Fix colobot-lint issues in restored code
---
src/object/auto/autokid.cpp | 35 +++++++++++++++++++----------------
src/object/auto/autokid.h | 20 ++++++++------------
src/object/object_factory.cpp | 4 ++--
3 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/src/object/auto/autokid.cpp b/src/object/auto/autokid.cpp
index 2cdf323..7206d7b 100644
--- a/src/object/auto/autokid.cpp
+++ b/src/object/auto/autokid.cpp
@@ -1,7 +1,7 @@
/*
* This file is part of the Colobot: Gold Edition source code
- * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
- * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* 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
@@ -53,9 +53,9 @@ CAutoKid::~CAutoKid()
// Destroys the object.
-void CAutoKid::DeleteObject(bool bAll)
+void CAutoKid::DeleteObject(bool all)
{
- CAuto::DeleteObject(bAll);
+ CAuto::DeleteObject(all);
}
@@ -63,22 +63,20 @@ void CAutoKid::DeleteObject(bool bAll)
void CAutoKid::Init()
{
- Math::Vector pos;
-
m_speed = 1.0f/1.0f;
m_progress = 0.0f;
m_lastParticle = 0.0f;
if ( m_type == OBJECT_TEEN36 ) // trunk ?
{
- pos = m_object->GetPosition();
+ Math::Vector pos = m_object->GetPosition();
m_speed = 1.0f/(1.0f+(Math::Mod(pos.x/10.0f-0.5f, 1.0f)*0.2f));
m_progress = Math::Mod(pos.x/10.0f, 1.0f);
}
if ( m_type == OBJECT_TEEN37 ) // boat?
{
- pos = m_object->GetPosition();
+ Math::Vector pos = m_object->GetPosition();
m_speed = 1.0f/(1.0f+(Math::Mod(pos.x/10.0f-0.5f, 1.0f)*0.2f))*2.5f;
m_progress = Math::Mod(pos.x/10.0f, 1.0f);
}
@@ -88,7 +86,7 @@ void CAutoKid::Init()
if ( m_soundChannel == -1 )
{
//? m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 1.0f, 0.5f, true);
- m_bSilent = false;
+ m_silent = false;
}
}
}
@@ -98,27 +96,24 @@ void CAutoKid::Init()
bool CAutoKid::EventProcess(const Event &event)
{
- Math::Vector vib, pos, speed;
- Math::Point dim;
-
CAuto::EventProcess(event);
if ( m_soundChannel != -1 )
{
if ( m_engine->GetPause() )
{
- if ( !m_bSilent )
+ if ( !m_silent )
{
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.1f, SOPER_CONTINUE);
- m_bSilent = true;
+ m_silent = true;
}
}
else
{
- if ( m_bSilent )
+ if ( m_silent )
{
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.5f, 0.1f, SOPER_CONTINUE);
- m_bSilent = false;
+ m_silent = false;
}
}
}
@@ -130,6 +125,7 @@ bool CAutoKid::EventProcess(const Event &event)
if ( m_type == OBJECT_TEEN36 ) // trunk?
{
+ Math::Vector vib;
vib.x = 0.0f;
vib.y = sinf(m_progress)*1.0f;
vib.z = 0.0f;
@@ -144,13 +140,16 @@ bool CAutoKid::EventProcess(const Event &event)
{
m_lastParticle = m_time;
+ Math::Vector pos;
pos = m_object->GetPosition();
pos.y = m_water->GetLevel()+1.0f;
pos.x += (Math::Rand()-0.5f)*50.0f;
pos.z += (Math::Rand()-0.5f)*50.0f;
+ Math::Vector speed;
speed.y = 0.0f;
speed.x = 0.0f;
speed.z = 0.0f;
+ Math::Point dim;
dim.x = 50.0f;
dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLIC, 3.0f, 0.0f, 0.0f);
@@ -159,6 +158,7 @@ bool CAutoKid::EventProcess(const Event &event)
if ( m_type == OBJECT_TEEN37 ) // boat?
{
+ Math::Vector vib;
vib.x = 0.0f;
vib.y = sinf(m_progress)*1.0f;
vib.z = 0.0f;
@@ -173,13 +173,16 @@ bool CAutoKid::EventProcess(const Event &event)
{
m_lastParticle = m_time;
+ Math::Vector pos;
pos = m_object->GetPosition();
pos.y = m_water->GetLevel()+1.0f;
pos.x += (Math::Rand()-0.5f)*20.0f;
pos.z += (Math::Rand()-0.5f)*20.0f;
+ Math::Vector speed;
speed.y = 0.0f;
speed.x = 0.0f;
speed.z = 0.0f;
+ Math::Point dim;
dim.x = 20.0f;
dim.y = dim.x;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLIC, 3.0f, 0.0f, 0.0f);
diff --git a/src/object/auto/autokid.h b/src/object/auto/autokid.h
index 605587c..8392722 100644
--- a/src/object/auto/autokid.h
+++ b/src/object/auto/autokid.h
@@ -1,7 +1,7 @@
/*
* This file is part of the Colobot: Gold Edition source code
- * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
- * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* 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
@@ -17,8 +17,6 @@
* along with this program. If not, see http://gnu.org/licenses
*/
-// autokid.h
-
#pragma once
@@ -31,18 +29,16 @@ public:
CAutoKid(COldObject* object);
~CAutoKid();
- void DeleteObject(bool bAll=false);
+ void DeleteObject(bool all = false);
void Init();
bool EventProcess(const Event &event);
Error GetError();
protected:
-
-protected:
- float m_speed;
- float m_progress;
- float m_lastParticle;
- int m_soundChannel;
- bool m_bSilent;
+ float m_speed = 0.0f;
+ float m_progress = 0.0f;
+ float m_lastParticle = 0.0f;
+ int m_soundChannel = 0;
+ bool m_silent = false;
};
diff --git a/src/object/object_factory.cpp b/src/object/object_factory.cpp
index b8f86f4..d39644a 100644
--- a/src/object/object_factory.cpp
+++ b/src/object/object_factory.cpp
@@ -903,7 +903,7 @@ CObjectUPtr CObjectFactory::CreateTeen(const ObjectCreateParams& params)
ObjectType type = params.type;
int option = params.option;
- COldObjectUPtr obj{new COldObject(params.id)};
+ COldObjectUPtr obj = MakeUnique<COldObject>(params.id);
obj->SetType(type);
obj->SetOption(option);
@@ -2563,7 +2563,7 @@ void CObjectFactory::AddObjectAuto(COldObject* obj)
type == OBJECT_TEEN37 || // boat?
type == OBJECT_TEEN38 ) // fan?
{
- objAuto.reset(new CAutoKid(obj));
+ objAuto = MakeUnique<CAutoKid>(obj);
}
if (objAuto != nullptr)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list