From 652dc6081df8dc73bc9f57c031420e498be71451 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 11 Jan 2014 23:42:45 +0100 Subject: Removed some unused objects --- src/object/task/taskgoto.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/object/task') diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 01ff38b..8070d13 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -1559,8 +1559,8 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir) oType == OBJECT_BOMB || (oType >= OBJECT_PLANT0 && oType <= OBJECT_PLANT19 ) || - (oType >= OBJECT_MUSHROOM0 && - oType <= OBJECT_MUSHROOM9 ) ) continue; + (oType >= OBJECT_MUSHROOM1 && + oType <= OBJECT_MUSHROOM2 ) ) continue; } addi = add; -- cgit v1.2.3-1-g7c22 From fbe2bf8bc7d61a7a13759f56e65181e16e25806b Mon Sep 17 00:00:00 2001 From: krzys-h Date: Mon, 3 Mar 2014 21:55:28 +0100 Subject: Added special mode in scene for bots to build more buildings than they usualy can Will be used in "Leaving Earth" missions for making decorative bots building base --- src/object/task/taskbuild.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/object/task') diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index 4a62a4a..4dfd6fb 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -100,6 +100,7 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle) if ( m_type == OBJECT_PARA ) m_buildingHeight = 68.0f; if ( m_type == OBJECT_INFO ) m_buildingHeight = 19.0f; if ( m_type == OBJECT_DESTROYER) m_buildingHeight = 35.0f; + if ( m_type == OBJECT_HUSTON ) m_buildingHeight = 45.0f; m_buildingHeight *= 0.25f; m_buildingPos = m_building->GetPosition(0); @@ -574,7 +575,7 @@ Error CTaskBuild::FlatFloor() if ( m_type == OBJECT_PARA ) radius = 20.0f; if ( m_type == OBJECT_INFO ) radius = 5.0f; if ( m_type == OBJECT_DESTROYER) radius = 20.0f; - if ( radius == 0.0f ) return ERR_GENERIC; + //if ( radius == 0.0f ) return ERR_GENERIC; center = m_metal->GetPosition(0); angle = m_terrain->GetFineSlope(center); -- cgit v1.2.3-1-g7c22 From e569fd6c3938ca885bfca0978d143def154abd73 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Sun, 16 Mar 2014 15:25:49 +0100 Subject: Fix for #294 --- src/object/task/taskrecover.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/object/task') diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index af84099..d8bbafd 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -105,9 +105,11 @@ bool CTaskRecover::EventProcess(const Event &event) if ( power != 0 ) { energy = power->GetEnergy(); - power->SetEnergy(energy-ENERGY_RECOVER*event.rTime*m_speed); + energy -= event.rTime * ENERGY_RECOVER / power->GetCapacity() * m_speed; + power->SetEnergy(energy); } + speed.x = (Math::Rand()-0.5f)*0.1f*m_progress; speed.y = (Math::Rand()-0.5f)*0.1f*m_progress; speed.z = (Math::Rand()-0.5f)*0.1f*m_progress; -- cgit v1.2.3-1-g7c22 From 7485ed790caeaa76efab0e9df48224cf1943ec27 Mon Sep 17 00:00:00 2001 From: Oleg Kosmakov Date: Fri, 21 Mar 2014 13:08:36 +0200 Subject: Fixes #295 When cannon cannot turn at specified angle, it will still reach the edge angle, but return the error code --- src/object/task/taskgungoal.cpp | 24 ++++++++++++++++++++++-- src/object/task/taskgungoal.h | 2 ++ 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src/object/task') diff --git a/src/object/task/taskgungoal.cpp b/src/object/task/taskgungoal.cpp index 3373610..c9c8d30 100644 --- a/src/object/task/taskgungoal.cpp +++ b/src/object/task/taskgungoal.cpp @@ -26,6 +26,7 @@ CTaskGunGoal::CTaskGunGoal(CObject* object) : CTask(object) { + m_aimImpossible = false; } // Object's destructor. @@ -116,6 +117,12 @@ Error CTaskGunGoal::Start(float dirV, float dirH) m_progress = 0.0f; + // direction was constrainted, hence resulting in impossible move + if (dirV != m_finalDirV || dirH != m_finalDirH) + { + m_aimImpossible = true; + } + return ERR_OK; } @@ -126,12 +133,25 @@ Error CTaskGunGoal::IsEnded() if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_initialDirV == m_finalDirV && - m_initialDirH == m_finalDirH ) return ERR_STOP; - if ( m_progress < 1.0f ) return ERR_CONTINUE; + m_initialDirH == m_finalDirH ) + { + if ( m_aimImpossible ) + return ERR_AIM_IMPOSSIBLE; + else + return ERR_STOP; + } + + if ( m_progress < 1.0f ) return ERR_CONTINUE; m_object->SetGunGoalV(m_finalDirV); m_object->SetGunGoalH(m_finalDirH); Abort(); + + if ( m_aimImpossible ) + { + return ERR_AIM_IMPOSSIBLE; + } + return ERR_STOP; } diff --git a/src/object/task/taskgungoal.h b/src/object/task/taskgungoal.h index c6f010b..9fc509d 100644 --- a/src/object/task/taskgungoal.h +++ b/src/object/task/taskgungoal.h @@ -44,5 +44,7 @@ protected: float m_finalDirV; // direction to reach float m_initialDirH; // initial direction float m_finalDirH; // direction to reach + + bool m_aimImpossible; // set to true if impossible aim was set }; -- cgit v1.2.3-1-g7c22 From 1835d2ae580525603308206f7b8e6b4552b3ca0f Mon Sep 17 00:00:00 2001 From: krzys-h Date: Fri, 27 Jun 2014 19:50:09 +0200 Subject: Removed old code based on #ifs (issue #55) --- src/object/task/taskterraform.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'src/object/task') diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index 096e5de..61ff045 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -76,15 +76,9 @@ bool CTaskTerraform::EventProcess(const Event &event) { if ( m_soundChannel == -1 ) { -#if _TEEN - m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); - m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 1.5f, SOPER_CONTINUE); - m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); -#else m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 4.0f, SOPER_CONTINUE); m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); -#endif } dir.x = 0.0f; @@ -109,11 +103,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase == TTP_DOWN ) { pos.x = 9.0f; -#if _TEEN - pos.y = 4.0f-m_progress*4.0f; -#else pos.y = 4.0f-m_progress*5.8f; -#endif pos.z = 0.0f; m_object->SetPosition(2, pos); } @@ -121,11 +111,7 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_phase == TTP_UP ) { pos.x = 9.0f; -#if _TEEN - pos.y = 4.0f-(1.0f-m_progress)*4.0f; -#else pos.y = 4.0f-(1.0f-m_progress)*5.8f; -#endif pos.z = 0.0f; m_object->SetPosition(2, pos); } @@ -230,11 +216,7 @@ Error CTaskTerraform::Start() m_phase = TTP_CHARGE; m_progress = 0.0f; -#if _TEEN - m_speed = 1.0f/1.5f; -#else m_speed = 1.0f/4.0f; -#endif m_time = 0.0f; m_bError = false; // ok @@ -261,9 +243,6 @@ Error CTaskTerraform::IsEnded() if ( m_phase == TTP_CHARGE ) { -#if _TEEN - Terraform(); // changes the terrain. -#endif m_phase = TTP_DOWN; m_speed = 1.0f/0.2f; @@ -272,9 +251,7 @@ Error CTaskTerraform::IsEnded() if ( m_phase == TTP_DOWN ) { -#if !_TEEN Terraform(); // changes the terrain. -#endif m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetZoom(0, 1.0f); -- cgit v1.2.3-1-g7c22