Make CTask classes use COldObject
parent
45302a3f4e
commit
3ed8980c46
|
@ -5157,8 +5157,9 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
|
|||
if (cargo != nullptr)
|
||||
{
|
||||
assert(obj->Implements(ObjectInterfaceType::Carrier)); // TODO: exception?
|
||||
assert(obj->Implements(ObjectInterfaceType::Old));
|
||||
dynamic_cast<CCarrierObject*>(obj)->SetCargo(cargo);
|
||||
CTaskManip* task = new CTaskManip(obj);
|
||||
CTaskManip* task = new CTaskManip(dynamic_cast<COldObject*>(obj));
|
||||
task->Start(TMO_AUTO, TMA_GRAB); // holds the object!
|
||||
delete task;
|
||||
}
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
#include "app/app.h"
|
||||
|
||||
#include "object/object.h"
|
||||
#include "object/old_object.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "object/interface/programmable_object.h"
|
||||
|
||||
|
||||
// Object's constructor.
|
||||
|
||||
CTask::CTask(CObject* object)
|
||||
CTask::CTask(COldObject* object)
|
||||
{
|
||||
m_sound = CApplication::GetInstancePointer()->GetSound();
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
class CBrain;
|
||||
class CPhysics;
|
||||
class CMotion;
|
||||
class CObject;
|
||||
class COldObject;
|
||||
class CRobotMain;
|
||||
class CSoundInterface;
|
||||
|
||||
|
@ -64,7 +64,7 @@ const float ARM_STOCK_ANGLE3 = -70.0f*Math::PI/180.0f;
|
|||
class CTask
|
||||
{
|
||||
public:
|
||||
CTask(CObject* object);
|
||||
CTask(COldObject* object);
|
||||
virtual ~CTask();
|
||||
|
||||
virtual bool EventProcess(const Event &event);
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
CMotion* m_motion;
|
||||
CBrain* m_brain;
|
||||
CPhysics* m_physics;
|
||||
CObject* m_object;
|
||||
COldObject* m_object;
|
||||
CRobotMain* m_main;
|
||||
CSoundInterface* m_sound;
|
||||
};
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "physics/physics.h"
|
||||
|
||||
|
||||
|
@ -29,7 +30,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskAdvance::CTaskAdvance(CObject* object) : CTask(object)
|
||||
CTaskAdvance::CTaskAdvance(COldObject* object) : CTask(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
class CTaskAdvance : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskAdvance(CObject* object);
|
||||
CTaskAdvance(COldObject* object);
|
||||
~CTaskAdvance();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "object/auto/auto.h"
|
||||
#include "object/motion/motionhuman.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/old_object.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "object/interface/carrier_object.h"
|
||||
#include "object/interface/transportable_object.h"
|
||||
|
@ -41,7 +42,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskBuild::CTaskBuild(CObject* object) : CTask(object)
|
||||
CTaskBuild::CTaskBuild(COldObject* object) : CTask(object)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "math/vector.h"
|
||||
|
||||
|
||||
class CObject;
|
||||
|
||||
const float BUILDMARGIN = 16.0f;
|
||||
const int TBMAXLIGHT = 4;
|
||||
|
@ -48,7 +49,7 @@ enum TaskBuildPhase
|
|||
class CTaskBuild : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskBuild(CObject* object);
|
||||
CTaskBuild(COldObject* object);
|
||||
~CTaskBuild();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "graphics/engine/particle.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
|
||||
|
@ -32,7 +33,7 @@
|
|||
#include "physics/physics.h"
|
||||
|
||||
|
||||
CTaskDeleteMark::CTaskDeleteMark(CObject* object) : CTask(object)
|
||||
CTaskDeleteMark::CTaskDeleteMark(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_bExecuted = false;
|
||||
}
|
||||
|
@ -50,9 +51,9 @@ bool CTaskDeleteMark::EventProcess(const Event &event)
|
|||
Error CTaskDeleteMark::Start()
|
||||
{
|
||||
DeleteMark();
|
||||
|
||||
|
||||
m_bExecuted = true;
|
||||
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
@ -61,7 +62,7 @@ Error CTaskDeleteMark::IsEnded()
|
|||
{
|
||||
if ( m_bExecuted )
|
||||
return ERR_STOP;
|
||||
else
|
||||
else
|
||||
return ERR_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class CTaskDeleteMark : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskDeleteMark(CObject* object);
|
||||
CTaskDeleteMark(COldObject* object);
|
||||
~CTaskDeleteMark();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/interface/powered_object.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "physics/physics.h"
|
||||
|
||||
|
@ -37,9 +37,11 @@ const float ENERGY_FIREi = (0.10f/2.5f); // energy consumed/organic
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskFire::CTaskFire(CObject* object) : CTask(object)
|
||||
CTaskFire::CTaskFire(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_soundChannel = -1;
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Powered));
|
||||
}
|
||||
|
||||
// Object's destructor.
|
||||
|
@ -75,8 +77,7 @@ bool CTaskFire::EventProcess(const Event &event)
|
|||
m_lastSound -= event.rTime;
|
||||
m_progress += event.rTime*m_speed;
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Powered));
|
||||
CObject* power = dynamic_cast<CPoweredObject*>(m_object)->GetPower();
|
||||
CObject* power = m_object->GetPower();
|
||||
if (power != nullptr)
|
||||
{
|
||||
energy = power->GetEnergy();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class CTaskFire : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskFire(CObject* object);
|
||||
CTaskFire(COldObject* object);
|
||||
~CTaskFire();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "math/geometry.h"
|
||||
|
||||
#include "object/motion/motionant.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "physics/physics.h"
|
||||
|
||||
|
@ -33,7 +34,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskFireAnt::CTaskFireAnt(CObject* object) : CTask(object)
|
||||
CTaskFireAnt::CTaskFireAnt(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_phase = TFA_NULL;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ enum TaskFireAnt
|
|||
class CTaskFireAnt : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskFireAnt(CObject* object);
|
||||
CTaskFireAnt(COldObject* object);
|
||||
~CTaskFireAnt();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "graphics/engine/pyro_manager.h"
|
||||
#include "graphics/engine/water.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/motion/motionhuman.h"
|
||||
#include "object/interface/carrier_object.h"
|
||||
|
@ -38,7 +39,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskFlag::CTaskFlag(CObject* object) : CTask(object)
|
||||
CTaskFlag::CTaskFlag(COldObject* object) : CTask(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "math/vector.h"
|
||||
|
||||
|
||||
class CObject;
|
||||
|
||||
enum TaskFlagOrder
|
||||
{
|
||||
|
@ -39,7 +40,7 @@ enum TaskFlagOrder
|
|||
class CTaskFlag : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskFlag(CObject* object);
|
||||
CTaskFlag(COldObject* object);
|
||||
~CTaskFlag();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "object/task/taskgoto.h"
|
||||
|
||||
#include "common/event.h"
|
||||
|
@ -29,6 +27,7 @@
|
|||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/interface/transportable_object.h"
|
||||
|
||||
|
@ -51,7 +50,7 @@ const float SAFETY_MARGIN = 0.5f; // Smallest distance between two objects
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskGoto::CTaskGoto(CObject* object) : CTask(object)
|
||||
CTaskGoto::CTaskGoto(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_bmArray = 0;
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
#include "math/vector.h"
|
||||
|
||||
|
||||
class CObject;
|
||||
|
||||
const int MAXPOINTS = 500;
|
||||
|
||||
|
||||
|
||||
enum TaskGotoGoal
|
||||
{
|
||||
TGG_DEFAULT = -1, // default mode
|
||||
|
@ -76,7 +76,7 @@ enum TaskGotoPhase
|
|||
class CTaskGoto : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskGoto(CObject* object);
|
||||
CTaskGoto(COldObject* object);
|
||||
~CTaskGoto();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
|
||||
#include "object/task/taskgungoal.h"
|
||||
|
||||
#include "object/object.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskGunGoal::CTaskGunGoal(CObject* object) : CTask(object)
|
||||
CTaskGunGoal::CTaskGunGoal(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_aimImpossible = false;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class CTaskGunGoal : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskGunGoal(CObject* object);
|
||||
CTaskGunGoal(COldObject* object);
|
||||
~CTaskGunGoal();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskInfo::CTaskInfo(CObject* object) : CTask(object)
|
||||
CTaskInfo::CTaskInfo(COldObject* object) : CTask(object)
|
||||
, m_progress(0.0f)
|
||||
, m_speed(0.0f)
|
||||
, m_time(0.0f)
|
||||
|
|
|
@ -29,7 +29,7 @@ class CExchangePost;
|
|||
class CTaskInfo : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskInfo(CObject* object);
|
||||
CTaskInfo(COldObject* object);
|
||||
~CTaskInfo();
|
||||
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "object/task/taskmanager.h"
|
||||
|
||||
#include "object/task/taskwait.h"
|
||||
|
@ -39,12 +37,12 @@
|
|||
#include "object/task/taskspiderexplo.h"
|
||||
#include "object/task/taskreset.h"
|
||||
|
||||
|
||||
#include "object/old_object.h"
|
||||
|
||||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskManager::CTaskManager(CObject* object)
|
||||
CTaskManager::CTaskManager(COldObject* object)
|
||||
{
|
||||
m_task = nullptr;
|
||||
m_object = object;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
class CTaskManager
|
||||
{
|
||||
public:
|
||||
CTaskManager(CObject* object);
|
||||
CTaskManager(COldObject* object);
|
||||
~CTaskManager();
|
||||
|
||||
Error StartTaskWait(float time);
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
protected:
|
||||
CTask* m_task;
|
||||
CObject* m_object;
|
||||
COldObject* m_object;
|
||||
bool m_bPilot;
|
||||
};
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "object/interface/carrier_object.h"
|
||||
|
@ -48,16 +49,13 @@ const float MARGIN_BEE = 5.0f; //OK 1.9
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskManip::CTaskManip(CObject* object) : CTask(object)
|
||||
CTaskManip::CTaskManip(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_arm = TMA_NEUTRAL;
|
||||
m_hand = TMH_OPEN;
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Carrier));
|
||||
m_carrierObject = dynamic_cast<CCarrierObject*>(m_object);
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Powered));
|
||||
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
|
||||
}
|
||||
|
||||
// Object's destructor.
|
||||
|
@ -316,7 +314,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
type = m_object->GetType();
|
||||
if ( type == OBJECT_BEE ) // bee?
|
||||
{
|
||||
if (m_carrierObject->GetCargo() == nullptr)
|
||||
if (m_object->GetCargo() == nullptr)
|
||||
{
|
||||
if ( !m_physics->GetLand() ) return ERR_MANIP_FLY;
|
||||
|
||||
|
@ -324,17 +322,17 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
if (other == nullptr) return ERR_MANIP_NIL;
|
||||
assert(other->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
m_carrierObject->SetCargo(other); // takes the ball
|
||||
m_object->SetCargo(other); // takes the ball
|
||||
dynamic_cast<CTransportableObject*>(other)->SetTransporter(m_object);
|
||||
dynamic_cast<CTransportableObject*>(other)->SetTransporterPart(0); // taken with the base
|
||||
other->SetPosition(0, Math::Vector(0.0f, -3.0f, 0.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
other = m_carrierObject->GetCargo(); // other = ball
|
||||
other = m_object->GetCargo(); // other = ball
|
||||
assert(other->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
m_carrierObject->SetCargo(nullptr); // lick the ball
|
||||
m_object->SetCargo(nullptr); // lick the ball
|
||||
dynamic_cast<CTransportableObject*>(other)->SetTransporter(nullptr);
|
||||
pos = m_object->GetPosition();
|
||||
pos.y -= 3.0f;
|
||||
|
@ -363,7 +361,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
}
|
||||
|
||||
m_energy = 0.0f;
|
||||
power = m_poweredObject->GetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
m_energy = power->GetEnergy();
|
||||
|
@ -387,7 +385,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
|
||||
if ( order == TMO_AUTO )
|
||||
{
|
||||
if (m_carrierObject->GetCargo() == nullptr)
|
||||
if (m_object->GetCargo() == nullptr)
|
||||
{
|
||||
m_order = TMO_GRAB;
|
||||
}
|
||||
|
@ -401,11 +399,11 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
m_order = order;
|
||||
}
|
||||
|
||||
if (m_order == TMO_GRAB && m_carrierObject->GetCargo() != nullptr)
|
||||
if (m_order == TMO_GRAB && m_object->GetCargo() != nullptr)
|
||||
{
|
||||
return ERR_MANIP_BUSY;
|
||||
}
|
||||
if (m_order == TMO_DROP && m_carrierObject->GetCargo() == nullptr)
|
||||
if (m_order == TMO_DROP && m_object->GetCargo() == nullptr)
|
||||
{
|
||||
return ERR_MANIP_EMPTY;
|
||||
}
|
||||
|
@ -453,7 +451,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
}
|
||||
if ( m_arm == TMA_POWER )
|
||||
{
|
||||
if (m_poweredObject->GetPower() == nullptr) return ERR_MANIP_NIL;
|
||||
if (m_object->GetPower() == nullptr) return ERR_MANIP_NIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +479,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
}
|
||||
if ( m_arm == TMA_POWER )
|
||||
{
|
||||
if (m_poweredObject->GetPower() != nullptr) return ERR_MANIP_OCC;
|
||||
if (m_object->GetPower() != nullptr) return ERR_MANIP_OCC;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,7 +499,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
|
|||
if ( m_timeLimit < 0.5f ) m_timeLimit = 0.5f;
|
||||
}
|
||||
|
||||
if (m_carrierObject->GetCargo() == nullptr) // not carrying anything?
|
||||
if (m_object->GetCargo() == nullptr) // not carrying anything?
|
||||
{
|
||||
m_hand = TMH_OPEN; // open clamp
|
||||
}
|
||||
|
@ -626,7 +624,7 @@ Error CTaskManip::IsEnded()
|
|||
{
|
||||
if ( m_bSubm ) m_speed = 1.0f/1.5f;
|
||||
if ( !TransporterTakeObject() &&
|
||||
m_carrierObject->GetCargo() == nullptr)
|
||||
m_object->GetCargo() == nullptr)
|
||||
{
|
||||
m_hand = TMH_OPEN; // reopens the clamp
|
||||
m_arm = TMA_NEUTRAL;
|
||||
|
@ -655,7 +653,7 @@ Error CTaskManip::IsEnded()
|
|||
if ( m_step == 1 )
|
||||
{
|
||||
if ( m_bSubm ) m_speed = 1.0f/0.7f;
|
||||
cargo = m_carrierObject->GetCargo();
|
||||
cargo = m_object->GetCargo();
|
||||
if (TransporterDeposeObject())
|
||||
{
|
||||
if ( (m_arm == TMA_OTHER ||
|
||||
|
@ -693,7 +691,7 @@ Error CTaskManip::IsEnded()
|
|||
|
||||
bool CTaskManip::Abort()
|
||||
{
|
||||
if (m_carrierObject->GetCargo() == nullptr) // not carrying anything?
|
||||
if (m_object->GetCargo() == nullptr) // not carrying anything?
|
||||
{
|
||||
m_hand = TMH_OPEN; // open clamp
|
||||
m_arm = TMA_NEUTRAL;
|
||||
|
@ -1084,7 +1082,7 @@ bool CTaskManip::TransporterTakeObject()
|
|||
{
|
||||
if (m_arm == TMA_GRAB) // takes immediately?
|
||||
{
|
||||
CObject* cargo = m_carrierObject->GetCargo();
|
||||
CObject* cargo = m_object->GetCargo();
|
||||
if (cargo == nullptr) return false; // nothing to take?
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
|
@ -1124,7 +1122,7 @@ bool CTaskManip::TransporterTakeObject()
|
|||
cargo->SetAngleY(0, 0.0f);
|
||||
}
|
||||
|
||||
m_carrierObject->SetCargo(cargo); // takes
|
||||
m_object->SetCargo(cargo); // takes
|
||||
}
|
||||
|
||||
if (m_arm == TMA_FFRONT) // takes on the ground in front?
|
||||
|
@ -1160,7 +1158,7 @@ bool CTaskManip::TransporterTakeObject()
|
|||
cargo->SetAngleY(0, 0.0f);
|
||||
}
|
||||
|
||||
m_carrierObject->SetCargo(cargo); // takes
|
||||
m_object->SetCargo(cargo); // takes
|
||||
}
|
||||
|
||||
if (m_arm == TMA_FBACK) // takes on the ground behind?
|
||||
|
@ -1182,12 +1180,12 @@ bool CTaskManip::TransporterTakeObject()
|
|||
cargo->SetAngleZ(0, Math::PI/2.0f);
|
||||
cargo->SetAngleY(0, 0.0f);
|
||||
|
||||
m_carrierObject->SetCargo(cargo); // takes
|
||||
m_object->SetCargo(cargo); // takes
|
||||
}
|
||||
|
||||
if (m_arm == TMA_POWER) // takes battery in the back?
|
||||
{
|
||||
CObject* cargo = m_poweredObject->GetPower();
|
||||
CObject* cargo = m_object->GetPower();
|
||||
if (cargo == nullptr) return false; // no battery?
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
|
@ -1200,8 +1198,8 @@ bool CTaskManip::TransporterTakeObject()
|
|||
cargo->SetAngleY(0, 0.0f);
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporterPart(3); // takes with the hand
|
||||
|
||||
m_poweredObject->SetPower(nullptr);
|
||||
m_carrierObject->SetCargo(cargo); // takes
|
||||
m_object->SetPower(nullptr);
|
||||
m_object->SetCargo(cargo); // takes
|
||||
}
|
||||
|
||||
if (m_arm == TMA_OTHER) // battery takes from friend?
|
||||
|
@ -1228,7 +1226,7 @@ bool CTaskManip::TransporterTakeObject()
|
|||
cargo->SetAngleZ(0, Math::PI/2.0f);
|
||||
cargo->SetAngleY(0, 0.0f);
|
||||
|
||||
m_carrierObject->SetCargo(cargo); // takes
|
||||
m_object->SetCargo(cargo); // takes
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1240,7 +1238,7 @@ bool CTaskManip::TransporterDeposeObject()
|
|||
{
|
||||
if (m_arm == TMA_FFRONT) // deposits on the ground in front?
|
||||
{
|
||||
CObject* cargo = m_carrierObject->GetCargo();
|
||||
CObject* cargo = m_object->GetCargo();
|
||||
if (cargo == nullptr) return false; // nothing transported?
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
|
@ -1256,12 +1254,12 @@ bool CTaskManip::TransporterDeposeObject()
|
|||
cargo->FloorAdjust(); // plate well on the ground
|
||||
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(0);
|
||||
m_carrierObject->SetCargo(nullptr); // deposit
|
||||
m_object->SetCargo(nullptr); // deposit
|
||||
}
|
||||
|
||||
if (m_arm == TMA_FBACK) // deposited on the ground behind?
|
||||
{
|
||||
CObject* cargo = m_carrierObject->GetCargo();
|
||||
CObject* cargo = m_object->GetCargo();
|
||||
if (cargo == nullptr) return false; // nothing transported?
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
|
@ -1276,18 +1274,18 @@ bool CTaskManip::TransporterDeposeObject()
|
|||
cargo->SetAngleZ(0, 0.0f);
|
||||
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(0);
|
||||
m_carrierObject->SetCargo(nullptr); // deposit
|
||||
m_object->SetCargo(nullptr); // deposit
|
||||
}
|
||||
|
||||
if (m_arm == TMA_POWER) // deposits battery in the back?
|
||||
{
|
||||
CObject* cargo = m_carrierObject->GetCargo();
|
||||
CObject* cargo = m_object->GetCargo();
|
||||
if (cargo == nullptr) return false; // nothing transported?
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
m_cargoType = cargo->GetType();
|
||||
|
||||
if (m_poweredObject->GetPower() != nullptr) return false;
|
||||
if (m_object->GetPower() != nullptr) return false;
|
||||
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(m_object);
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporterPart(0); // carried by the base
|
||||
|
@ -1298,8 +1296,8 @@ bool CTaskManip::TransporterDeposeObject()
|
|||
cargo->SetAngleX(0, 0.0f);
|
||||
cargo->SetAngleZ(0, 0.0f);
|
||||
|
||||
m_poweredObject->SetPower(cargo); // uses
|
||||
m_carrierObject->SetCargo(nullptr);
|
||||
m_object->SetPower(cargo); // uses
|
||||
m_object->SetCargo(nullptr);
|
||||
}
|
||||
|
||||
if (m_arm == TMA_OTHER) // deposits battery on friend?
|
||||
|
@ -1314,7 +1312,7 @@ bool CTaskManip::TransporterDeposeObject()
|
|||
CObject* cargo = dynamic_cast<CPoweredObject*>(other)->GetPower();
|
||||
if (cargo != nullptr) return false; // the other already has a battery?
|
||||
|
||||
cargo = m_carrierObject->GetCargo();
|
||||
cargo = m_object->GetCargo();
|
||||
if (cargo == nullptr) return false;
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
|
@ -1330,7 +1328,7 @@ bool CTaskManip::TransporterDeposeObject()
|
|||
cargo->SetAngleZ(0, 0.0f);
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporterPart(0); // carried by the base
|
||||
|
||||
m_carrierObject->SetCargo(nullptr); // deposit
|
||||
m_object->SetCargo(nullptr); // deposit
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
|
||||
|
||||
|
||||
class CCarrierObject;
|
||||
class CPoweredObject;
|
||||
class CObject;
|
||||
|
||||
enum TaskManipOrder
|
||||
{
|
||||
|
@ -60,7 +59,7 @@ enum TaskManipHand
|
|||
class CTaskManip : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskManip(CObject* object);
|
||||
CTaskManip(COldObject* object);
|
||||
~CTaskManip();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
@ -81,8 +80,6 @@ protected:
|
|||
void SoundManip(float time, float amplitude=1.0f, float frequency=1.0f);
|
||||
|
||||
protected:
|
||||
CCarrierObject* m_carrierObject;
|
||||
CPoweredObject* m_poweredObject;
|
||||
TaskManipOrder m_order;
|
||||
TaskManipArm m_arm;
|
||||
TaskManipHand m_hand;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "graphics/engine/particle.h"
|
||||
|
||||
#include "object/object.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskPen::CTaskPen(CObject* object) : CTask(object)
|
||||
CTaskPen::CTaskPen(COldObject* object) : CTask(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ enum TaskPenPhase
|
|||
class CTaskPen : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskPen(CObject* object);
|
||||
CTaskPen(COldObject* object);
|
||||
~CTaskPen();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "object/task/taskrecover.h"
|
||||
|
||||
#include "graphics/engine/particle.h"
|
||||
|
@ -28,6 +26,7 @@
|
|||
|
||||
#include "physics/physics.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "object/interface/powered_object.h"
|
||||
|
@ -40,7 +39,7 @@ const float RECOVER_DIST = 11.8f;
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskRecover::CTaskRecover(CObject* object) : CTask(object)
|
||||
CTaskRecover::CTaskRecover(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_ruin = 0;
|
||||
m_soundChannel = -1;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "math/vector.h"
|
||||
|
||||
|
||||
class CObject;
|
||||
|
||||
enum TaskRecoverPhase
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ enum TaskRecoverPhase
|
|||
class CTaskRecover : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskRecover(CObject* object);
|
||||
CTaskRecover(COldObject* object);
|
||||
~CTaskRecover();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "object/task/taskreset.h"
|
||||
|
||||
#include "object/brain.h"
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "object/interface/carrier_object.h"
|
||||
|
@ -37,7 +38,7 @@ const float RESET_DELAY_MOVE = 0.7f;
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskReset::CTaskReset(CObject* object) : CTask(object)
|
||||
CTaskReset::CTaskReset(COldObject* object) : CTask(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
|
||||
#include "object/task/task.h"
|
||||
|
||||
#include "math/vector.h"
|
||||
|
||||
|
||||
|
@ -39,7 +40,7 @@ enum TaskResetPhase
|
|||
class CTaskReset : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskReset(CObject* object);
|
||||
CTaskReset(COldObject* object);
|
||||
~CTaskReset();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
|
||||
|
@ -33,7 +34,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskSearch::CTaskSearch(CObject* object) : CTask(object)
|
||||
CTaskSearch::CTaskSearch(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_hand = TSH_UP;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ enum TaskSearchPhase
|
|||
class CTaskSearch : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskSearch(CObject* object);
|
||||
CTaskSearch(COldObject* object);
|
||||
~CTaskSearch();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "math/geometry.h"
|
||||
|
||||
#include "object/brain.h"
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "object/interface/powered_object.h"
|
||||
|
@ -41,14 +42,13 @@ const float ENERGY_TIME = 20.0f; // maximum duration if full battery
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskShield::CTaskShield(CObject* object) : CTask(object)
|
||||
CTaskShield::CTaskShield(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_rankSphere = -1;
|
||||
m_soundChannel = -1;
|
||||
m_effectLight = -1;
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Powered));
|
||||
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
|
||||
}
|
||||
|
||||
// Object's destructor.
|
||||
|
@ -112,7 +112,7 @@ bool CTaskShield::EventProcess(const Event &event)
|
|||
{
|
||||
energy = (1.0f/ENERGY_TIME)*event.rTime;
|
||||
energy *= GetRadius()/RADIUS_SHIELD_MAX;
|
||||
power = m_poweredObject->GetPower();
|
||||
power = m_object->GetPower();
|
||||
if (power != nullptr)
|
||||
{
|
||||
power->SetEnergy(power->GetEnergy()-energy/power->GetCapacity());
|
||||
|
@ -291,7 +291,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
|
|||
m_bError = true; // operation impossible
|
||||
if ( !m_physics->GetLand() ) return ERR_SHIELD_VEH;
|
||||
|
||||
CObject* power = m_poweredObject->GetPower();
|
||||
CObject* power = m_object->GetPower();
|
||||
if (power == nullptr) return ERR_SHIELD_ENERGY;
|
||||
float energy = power->GetEnergy();
|
||||
if ( energy == 0.0f ) return ERR_SHIELD_ENERGY;
|
||||
|
@ -380,7 +380,7 @@ Error CTaskShield::IsEnded()
|
|||
{
|
||||
m_object->SetShieldRadius(GetRadius());
|
||||
|
||||
power = m_poweredObject->GetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power == 0 )
|
||||
{
|
||||
energy = 0.0f;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "math/vector.h"
|
||||
|
||||
class CPoweredObject;
|
||||
|
||||
const float RADIUS_SHIELD_MIN = 40.0f; // minimum radius of the protected zone
|
||||
const float RADIUS_SHIELD_MAX = 100.0f; // maximum radius of the protected zone
|
||||
|
@ -55,7 +54,7 @@ enum TaskShieldMode
|
|||
class CTaskShield : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskShield(CObject* object);
|
||||
CTaskShield(COldObject* object);
|
||||
~CTaskShield();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
@ -72,7 +71,6 @@ protected:
|
|||
float GetRadius();
|
||||
|
||||
protected:
|
||||
CPoweredObject* m_poweredObject;
|
||||
TaskShieldPhase m_phase;
|
||||
float m_progress;
|
||||
float m_speed;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "graphics/engine/pyro_manager.h"
|
||||
|
||||
#include "object/motion/motionspider.h"
|
||||
#include "object/old_object.h"
|
||||
|
||||
#include "physics/physics.h"
|
||||
|
||||
|
@ -31,7 +32,7 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskSpiderExplo::CTaskSpiderExplo(CObject* object) : CTask(object)
|
||||
CTaskSpiderExplo::CTaskSpiderExplo(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_time = 0.0f;
|
||||
m_bError = false;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class CTaskSpiderExplo : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskSpiderExplo(CObject* object);
|
||||
CTaskSpiderExplo(COldObject* object);
|
||||
~CTaskSpiderExplo();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/motion/motionhuman.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
|
@ -39,15 +40,12 @@
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskTake::CTaskTake(CObject* object) : CTask(object)
|
||||
CTaskTake::CTaskTake(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_arm = TTA_NEUTRAL;
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Carrier));
|
||||
m_carrierObject = dynamic_cast<CCarrierObject*>(m_object);
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Powered));
|
||||
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
|
||||
}
|
||||
|
||||
// Object's destructor.
|
||||
|
@ -114,7 +112,7 @@ Error CTaskTake::Start()
|
|||
|
||||
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f));
|
||||
|
||||
if (m_carrierObject->IsCarryingCargo())
|
||||
if (m_object->IsCarryingCargo())
|
||||
m_order = TTO_DEPOSE;
|
||||
else
|
||||
m_order = TTO_TAKE;
|
||||
|
@ -259,7 +257,7 @@ Error CTaskTake::IsEnded()
|
|||
{
|
||||
if ( m_step == 1 )
|
||||
{
|
||||
CObject* cargo = m_carrierObject->GetCargo();
|
||||
CObject* cargo = m_object->GetCargo();
|
||||
TransporterDeposeObject();
|
||||
if ( m_arm == TTA_FRIEND &&
|
||||
(m_cargoType == OBJECT_POWER ||
|
||||
|
@ -463,7 +461,7 @@ bool CTaskTake::TransporterTakeObject()
|
|||
cargo->SetAngleX(0, 0.0f);
|
||||
cargo->SetAngleZ(0, 0.8f);
|
||||
|
||||
m_carrierObject->SetCargo(cargo); // takes
|
||||
m_object->SetCargo(cargo); // takes
|
||||
}
|
||||
|
||||
if (m_arm == TTA_FRIEND) // takes friend's battery?
|
||||
|
@ -489,7 +487,7 @@ bool CTaskTake::TransporterTakeObject()
|
|||
cargo->SetAngleX(0, 0.0f);
|
||||
cargo->SetAngleZ(0, 0.8f);
|
||||
|
||||
m_carrierObject->SetCargo(cargo); // takes
|
||||
m_object->SetCargo(cargo); // takes
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -501,7 +499,7 @@ bool CTaskTake::TransporterDeposeObject()
|
|||
{
|
||||
if ( m_arm == TTA_FFRONT ) // deposes on the ground in front?
|
||||
{
|
||||
CObject* cargo = m_carrierObject->GetCargo();
|
||||
CObject* cargo = m_object->GetCargo();
|
||||
if (cargo == nullptr) return false; // does nothing?
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
|
||||
|
@ -517,7 +515,7 @@ bool CTaskTake::TransporterDeposeObject()
|
|||
cargo->FloorAdjust(); // plate well on the ground
|
||||
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(nullptr);
|
||||
m_carrierObject->SetCargo(nullptr); // deposit
|
||||
m_object->SetCargo(nullptr); // deposit
|
||||
}
|
||||
|
||||
if ( m_arm == TTA_FRIEND ) // deposes battery on friends?
|
||||
|
@ -530,7 +528,7 @@ bool CTaskTake::TransporterDeposeObject()
|
|||
CObject* cargo = dynamic_cast<CPoweredObject*>(other)->GetPower();
|
||||
if (cargo != nullptr) return false; // the other already has a battery?
|
||||
|
||||
cargo = m_carrierObject->GetCargo();
|
||||
cargo = m_object->GetCargo();
|
||||
if (cargo == nullptr) return false;
|
||||
assert(cargo->Implements(ObjectInterfaceType::Transportable));
|
||||
m_cargoType = cargo->GetType();
|
||||
|
@ -545,7 +543,7 @@ bool CTaskTake::TransporterDeposeObject()
|
|||
cargo->SetAngleZ(0, 0.0f);
|
||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporterPart(0); // carried by the base
|
||||
|
||||
m_carrierObject->SetCargo(nullptr); // deposit
|
||||
m_object->SetCargo(nullptr); // deposit
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -26,9 +26,7 @@
|
|||
#include "object/object.h"
|
||||
|
||||
|
||||
class CCarrierObject;
|
||||
class CPoweredObject;
|
||||
|
||||
class CObject;
|
||||
|
||||
enum TaskTakeOrder
|
||||
{
|
||||
|
@ -48,7 +46,7 @@ enum TaskTakeArm
|
|||
class CTaskTake : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskTake(CObject* object);
|
||||
CTaskTake(COldObject* object);
|
||||
~CTaskTake();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
@ -65,8 +63,6 @@ protected:
|
|||
bool IsFreeDeposeObject(Math::Vector pos);
|
||||
|
||||
protected:
|
||||
CCarrierObject* m_carrierObject;
|
||||
CPoweredObject* m_poweredObject;
|
||||
TaskTakeOrder m_order;
|
||||
TaskTakeArm m_arm;
|
||||
int m_step;
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "object/task/taskterraform.h"
|
||||
|
||||
#include "graphics/engine/pyro_manager.h"
|
||||
|
@ -28,6 +25,7 @@
|
|||
|
||||
#include "math/geometry.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/brain.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
|
@ -46,13 +44,12 @@ const float ACTION_RADIUS = 400.0f;
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskTerraform::CTaskTerraform(CObject* object) : CTask(object)
|
||||
CTaskTerraform::CTaskTerraform(COldObject* object) : CTask(object)
|
||||
{
|
||||
m_lastParticle = 0.0f;
|
||||
m_soundChannel = -1;
|
||||
|
||||
assert(m_object->Implements(ObjectInterfaceType::Powered));
|
||||
m_poweredObject = dynamic_cast<CPoweredObject*>(object);
|
||||
}
|
||||
|
||||
// Object's destructor.
|
||||
|
@ -95,7 +92,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
|
|||
|
||||
m_object->SetZoom(0, 1.0f+m_progress*0.2f);
|
||||
|
||||
power = m_poweredObject->GetPower();
|
||||
power = m_object->GetPower();
|
||||
if (power != nullptr)
|
||||
{
|
||||
power->SetZoom(0, 1.0f+m_progress*1.0f);
|
||||
|
@ -207,7 +204,7 @@ Error CTaskTerraform::Start()
|
|||
type = m_object->GetType();
|
||||
if ( type != OBJECT_MOBILErt ) return ERR_TERRA_VEH;
|
||||
|
||||
power = m_poweredObject->GetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power == 0 ) return ERR_TERRA_ENERGY;
|
||||
energy = power->GetEnergy();
|
||||
if ( energy < ENERGY_TERRA/power->GetCapacity()+0.05f ) return ERR_TERRA_ENERGY;
|
||||
|
@ -263,7 +260,7 @@ Error CTaskTerraform::IsEnded()
|
|||
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
|
||||
m_object->SetZoom(0, 1.0f);
|
||||
|
||||
power = m_poweredObject->GetPower();
|
||||
power = m_object->GetPower();
|
||||
if (power != nullptr)
|
||||
{
|
||||
power->SetZoom(0, 1.0f);
|
||||
|
@ -329,7 +326,7 @@ bool CTaskTerraform::Abort()
|
|||
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
|
||||
m_object->SetZoom(0, 1.0f);
|
||||
|
||||
power = m_poweredObject->GetPower();
|
||||
power = m_object->GetPower();
|
||||
if (power != nullptr)
|
||||
{
|
||||
power->SetZoom(0, 1.0f);
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "math/vector.h"
|
||||
|
||||
|
||||
class CPoweredObject;
|
||||
|
||||
enum TaskTerraPhase
|
||||
{
|
||||
TTP_CHARGE = 1, // charge of energy
|
||||
|
@ -42,7 +40,7 @@ enum TaskTerraPhase
|
|||
class CTaskTerraform : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskTerraform(CObject* object);
|
||||
CTaskTerraform(COldObject* object);
|
||||
~CTaskTerraform();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
@ -55,7 +53,6 @@ protected:
|
|||
bool Terraform();
|
||||
|
||||
protected:
|
||||
CPoweredObject* m_poweredObject;
|
||||
TaskTerraPhase m_phase;
|
||||
float m_progress;
|
||||
float m_speed;
|
||||
|
|
|
@ -23,12 +23,13 @@
|
|||
#include "graphics/engine/terrain.h"
|
||||
#include "physics/physics.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/robotmain.h"
|
||||
|
||||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskTurn::CTaskTurn(CObject* object) : CTask(object)
|
||||
CTaskTurn::CTaskTurn(COldObject* object) : CTask(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class CTaskTurn : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskTurn(CObject* object);
|
||||
CTaskTurn(COldObject* object);
|
||||
~CTaskTurn();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -22,9 +22,11 @@
|
|||
|
||||
#include "graphics/engine/engine.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
|
||||
// Object's constructor.
|
||||
|
||||
CTaskWait::CTaskWait(CObject* object) : CTask(object)
|
||||
CTaskWait::CTaskWait(COldObject* object) : CTask(object)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class CTaskWait : public CTask
|
||||
{
|
||||
public:
|
||||
CTaskWait(CObject* object);
|
||||
CTaskWait(COldObject* object);
|
||||
~CTaskWait();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "graphics/engine/engine.h"
|
||||
#include "graphics/engine/text.h"
|
||||
|
||||
#include "object/old_object.h"
|
||||
#include "object/task/taskmanager.h"
|
||||
#include "object/robotmain.h"
|
||||
|
||||
|
@ -49,7 +50,7 @@ const int CBOT_IPF = 100; // CBOT: default number of instructions / frame
|
|||
|
||||
// Object's constructor.
|
||||
|
||||
CScript::CScript(CObject* object, CTaskManager** secondaryTask)
|
||||
CScript::CScript(COldObject* object, CTaskManager** secondaryTask)
|
||||
{
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
m_main = CRobotMain::GetInstancePointer();
|
||||
|
@ -59,10 +60,10 @@ CScript::CScript(CObject* object, CTaskManager** secondaryTask)
|
|||
m_object = object;
|
||||
m_primaryTask = nullptr;
|
||||
m_secondaryTask = secondaryTask;
|
||||
|
||||
|
||||
m_interface = m_main->GetInterface();
|
||||
m_pause = CPauseManager::GetInstancePointer();
|
||||
|
||||
|
||||
m_ipf = CBOT_IPF;
|
||||
m_errMode = ERM_STOP;
|
||||
m_len = 0;
|
||||
|
@ -345,7 +346,7 @@ bool CScript::Run()
|
|||
if( m_botProg == 0 ) return false;
|
||||
if ( m_script == nullptr || m_len == 0 ) return false;
|
||||
if ( m_mainFunction[0] == 0 ) return false;
|
||||
|
||||
|
||||
if ( !m_botProg->Start(m_mainFunction) ) return false;
|
||||
|
||||
m_object->SetRunScript(this);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "CBot/CBotDll.h"
|
||||
|
||||
|
||||
class CObject;
|
||||
class COldObject;
|
||||
class CTaskManager;
|
||||
class CRobotMain;
|
||||
class CPauseManager;
|
||||
|
@ -59,7 +59,7 @@ class CScript
|
|||
{
|
||||
friend class CScriptFunctions;
|
||||
public:
|
||||
CScript(CObject* object, CTaskManager** secondaryTask);
|
||||
CScript(COldObject* object, CTaskManager** secondaryTask);
|
||||
~CScript();
|
||||
|
||||
void PutScript(Ui::CEdit* edit, const char* name);
|
||||
|
@ -108,7 +108,7 @@ protected:
|
|||
Gfx::CWater* m_water;
|
||||
CTaskManager* m_primaryTask;
|
||||
CTaskManager** m_secondaryTask;
|
||||
CObject* m_object;
|
||||
COldObject* m_object;
|
||||
CPauseManager* m_pause;
|
||||
|
||||
int m_ipf; // number of instructions/second
|
||||
|
|
Loading…
Reference in New Issue