2014-11-16 22:10:01 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Colobot: Gold Edition source code
|
2020-07-07 08:19:36 +00:00
|
|
|
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
|
2015-08-22 14:40:02 +00:00
|
|
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
2014-11-16 22:10:01 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see http://gnu.org/licenses
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "object/task/taskdeletemark.h"
|
|
|
|
|
2015-08-15 12:02:07 +00:00
|
|
|
#include "common/global.h"
|
|
|
|
|
2014-11-16 22:10:01 +00:00
|
|
|
#include "graphics/engine/particle.h"
|
|
|
|
#include "graphics/engine/terrain.h"
|
|
|
|
|
2021-07-03 18:42:25 +00:00
|
|
|
#include "graphics/pyro/pyro.h"
|
2020-07-26 10:41:26 +00:00
|
|
|
#include "graphics/pyro/pyro_manager.h"
|
|
|
|
|
2015-08-13 09:47:32 +00:00
|
|
|
#include "level/robotmain.h"
|
|
|
|
|
2015-08-02 11:09:48 +00:00
|
|
|
#include "math/geometry.h"
|
|
|
|
|
2015-06-20 18:02:40 +00:00
|
|
|
#include "object/object_manager.h"
|
2015-08-02 11:09:48 +00:00
|
|
|
#include "object/old_object.h"
|
2015-03-22 13:50:54 +00:00
|
|
|
|
2014-11-16 22:10:01 +00:00
|
|
|
#include "physics/physics.h"
|
|
|
|
|
|
|
|
|
2015-08-15 18:29:59 +00:00
|
|
|
CTaskDeleteMark::CTaskDeleteMark(COldObject* object) : CForegroundTask(object)
|
2014-11-16 22:10:01 +00:00
|
|
|
{
|
|
|
|
m_bExecuted = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
CTaskDeleteMark::~CTaskDeleteMark()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// Management of an event.
|
|
|
|
bool CTaskDeleteMark::EventProcess(const Event &event)
|
|
|
|
{
|
2015-03-22 13:50:54 +00:00
|
|
|
return true;
|
2014-11-16 22:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Error CTaskDeleteMark::Start()
|
|
|
|
{
|
|
|
|
DeleteMark();
|
2015-07-12 11:46:25 +00:00
|
|
|
|
2014-11-16 22:10:01 +00:00
|
|
|
m_bExecuted = true;
|
2015-07-12 11:46:25 +00:00
|
|
|
|
2014-11-16 22:10:01 +00:00
|
|
|
return ERR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Indicates whether the action is finished.
|
|
|
|
Error CTaskDeleteMark::IsEnded()
|
|
|
|
{
|
|
|
|
if ( m_bExecuted )
|
2015-03-22 13:50:54 +00:00
|
|
|
return ERR_STOP;
|
2015-07-12 11:46:25 +00:00
|
|
|
else
|
2015-03-22 13:50:54 +00:00
|
|
|
return ERR_CONTINUE;
|
2014-11-16 22:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Suddenly ends the current action.
|
|
|
|
bool CTaskDeleteMark::Abort()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CTaskDeleteMark::DeleteMark()
|
|
|
|
{
|
2015-06-21 09:16:09 +00:00
|
|
|
CObject* obj = CObjectManager::GetInstancePointer()->FindNearest(m_object, {
|
2015-03-22 13:50:54 +00:00
|
|
|
OBJECT_MARKPOWER,
|
|
|
|
OBJECT_MARKSTONE,
|
|
|
|
OBJECT_MARKURANIUM,
|
|
|
|
OBJECT_MARKKEYa,
|
|
|
|
OBJECT_MARKKEYb,
|
|
|
|
OBJECT_MARKKEYc,
|
|
|
|
OBJECT_MARKKEYd
|
|
|
|
}, 8.0f/g_unit);
|
|
|
|
|
2015-06-21 09:16:09 +00:00
|
|
|
if (obj != nullptr)
|
2014-11-16 22:10:01 +00:00
|
|
|
{
|
2021-07-03 18:42:25 +00:00
|
|
|
m_engine->GetPyroManager()->Create(MakeUnique<Gfx::CWaypointHitPyro>(obj));
|
2014-11-16 22:10:01 +00:00
|
|
|
}
|
2015-08-02 06:45:02 +00:00
|
|
|
}
|