Make CAuto classes use COldObject

master
Piotr Dziwinski 2015-07-12 11:33:52 +02:00
parent fdb594b9f7
commit 16883fcdc4
48 changed files with 143 additions and 185 deletions

View File

@ -20,26 +20,22 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
#include "app/app.h" #include "app/app.h"
#include "common/event.h" #include "common/event.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "object/old_object.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/gauge.h" #include "ui/gauge.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAuto::CAuto(CObject* object) CAuto::CAuto(COldObject* object)
{ {
m_object = object; m_object = object;
m_engine = Gfx::CEngine::GetInstancePointer(); m_engine = Gfx::CEngine::GetInstancePointer();

View File

@ -22,13 +22,16 @@
#pragma once #pragma once
#include "common/event.h"
#include "common/global.h" #include "common/global.h"
#include "object/object.h"
#include "object/object_type.h"
class CRobotMain; class CRobotMain;
class CSoundInterface; class CSoundInterface;
class CLevelParserLine; class CLevelParserLine;
class COldObject;
namespace Ui { namespace Ui {
class CInterface; class CInterface;
@ -46,13 +49,14 @@ class CCloud;
class CCamera; class CCamera;
class CPlanet; class CPlanet;
class CLightning; class CLightning;
class CTerrain;
} /* Gfx */ } /* Gfx */
class CAuto class CAuto
{ {
public: public:
CAuto(CObject* object); CAuto(COldObject* object);
virtual ~CAuto(); virtual ~CAuto();
virtual void DeleteObject(bool bAll=false); virtual void DeleteObject(bool bAll=false);
@ -103,7 +107,7 @@ protected:
Gfx::CCamera* m_camera; Gfx::CCamera* m_camera;
Ui::CInterface* m_interface; Ui::CInterface* m_interface;
CRobotMain* m_main; CRobotMain* m_main;
CObject* m_object; COldObject* m_object;
CSoundInterface* m_sound; CSoundInterface* m_sound;
ObjectType m_type; ObjectType m_type;

View File

@ -31,6 +31,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/robotmain.h" #include "object/robotmain.h"
#include "physics/physics.h" #include "physics/physics.h"
@ -54,7 +55,7 @@ const float BASE_TRANSIT_TIME = 15.0f; // transit duration
// Object's constructor. // Object's constructor.
CAutoBase::CAutoBase(CObject* object) : CAuto(object) CAutoBase::CAutoBase(COldObject* object) : CAuto(object)
{ {
m_fogStart = m_engine->GetFogStart(); m_fogStart = m_engine->GetFogStart();
m_deepView = m_engine->GetDeepView(); m_deepView = m_engine->GetDeepView();

View File

@ -24,6 +24,8 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
#include "graphics/core/color.h"
enum AutoBaseParam enum AutoBaseParam
@ -67,7 +69,7 @@ enum AutoBasePhase
class CAutoBase : public CAuto class CAutoBase : public CAuto
{ {
public: public:
CAutoBase(CObject* object); CAutoBase(COldObject* object);
~CAutoBase(); ~CAutoBase();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);
@ -79,8 +81,8 @@ public:
Error GetError(); Error GetError();
bool CreateInterface(bool bSelect); bool CreateInterface(bool bSelect);
Error TakeOff(bool printMsg); Error TakeOff(bool printMsg);
protected: protected:
void UpdateInterface(); void UpdateInterface();

View File

@ -23,6 +23,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "object/interface/transportable_object.h" #include "object/interface/transportable_object.h"
@ -30,13 +31,10 @@
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoConvert::CAutoConvert(CObject* object) : CAuto(object) CAutoConvert::CAutoConvert(COldObject* object) : CAuto(object)
{ {
Init(); Init();
m_phase = ACP_STOP; m_phase = ACP_STOP;

View File

@ -25,6 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoConvertPhase enum AutoConvertPhase
{ {
@ -40,7 +41,7 @@ enum AutoConvertPhase
class CAutoConvert : public CAuto class CAutoConvert : public CAuto
{ {
public: public:
CAutoConvert(CObject* object); CAutoConvert(COldObject* object);
~CAutoConvert(); ~CAutoConvert();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -25,15 +25,13 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
const float DERRICK_DELAY = 10.0f; // duration of the extraction const float DERRICK_DELAY = 10.0f; // duration of the extraction
@ -44,7 +42,7 @@ const float DERRICK_DELAYu = 30.0f; // same, but for uranium
// Object's constructor. // Object's constructor.
CAutoDerrick::CAutoDerrick(CObject* object) : CAuto(object) CAutoDerrick::CAutoDerrick(COldObject* object) : CAuto(object)
{ {
Init(); Init();
m_phase = ADP_WAIT; // paused until the first Init () m_phase = ADP_WAIT; // paused until the first Init ()

View File

@ -25,6 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoDerrickPhase enum AutoDerrickPhase
{ {
@ -40,7 +41,7 @@ enum AutoDerrickPhase
class CAutoDerrick : public CAuto class CAutoDerrick : public CAuto
{ {
public: public:
CAutoDerrick(CObject* object); CAutoDerrick(COldObject* object);
~CAutoDerrick(); ~CAutoDerrick();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -23,20 +23,18 @@
#include "graphics/engine/pyro_manager.h" #include "graphics/engine/pyro_manager.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoDestroyer::CAutoDestroyer(CObject* object) : CAuto(object) CAutoDestroyer::CAutoDestroyer(COldObject* object) : CAuto(object)
{ {
Init(); Init();
m_phase = ADEP_WAIT; // paused until the first Init () m_phase = ADEP_WAIT; // paused until the first Init ()

View File

@ -25,6 +25,8 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoDestroyerPhase enum AutoDestroyerPhase
{ {
@ -39,7 +41,7 @@ enum AutoDestroyerPhase
class CAutoDestroyer : public CAuto class CAutoDestroyer : public CAuto
{ {
public: public:
CAutoDestroyer(CObject* object); CAutoDestroyer(COldObject* object);
~CAutoDestroyer(); ~CAutoDestroyer();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -26,23 +26,19 @@
#include "object/brain.h" #include "object/brain.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/interface/programmable_object.h" #include "object/interface/programmable_object.h"
#include "object/interface/transportable_object.h" #include "object/interface/transportable_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoEgg::CAutoEgg(CObject* object) : CAuto(object) CAutoEgg::CAutoEgg(COldObject* object) : CAuto(object)
{ {
m_type = OBJECT_NULL; m_type = OBJECT_NULL;
m_value = 0.0f; m_value = 0.0f;
m_string[0] = 0;
m_param = 0; m_param = 0;
m_phase = AEP_NULL; m_phase = AEP_NULL;
@ -138,11 +134,9 @@ bool CAutoEgg::SetValue(int rank, float value)
return true; return true;
} }
// Getes the string.
bool CAutoEgg::SetString(char *string) bool CAutoEgg::SetString(char *string)
{ {
strcpy(m_string, string); m_alienProgramName = string;
return true; return true;
} }
@ -189,7 +183,7 @@ bool CAutoEgg::EventProcess(const Event &event)
CBrain* brain = dynamic_cast<CProgrammableObject*>(alien)->GetBrain(); CBrain* brain = dynamic_cast<CProgrammableObject*>(alien)->GetBrain();
Program* program = brain->AddProgram(); Program* program = brain->AddProgram();
brain->ReadProgram(program, m_string); brain->ReadProgram(program, m_alienProgramName.c_str());
brain->RunProgram(program); brain->RunProgram(program);
} }
Init(); Init();
@ -312,7 +306,7 @@ bool CAutoEgg::Write(CLevelParserLine* line)
line->AddParam("aSpeed", CLevelParserParamUPtr{new CLevelParserParam(m_speed)}); line->AddParam("aSpeed", CLevelParserParamUPtr{new CLevelParserParam(m_speed)});
line->AddParam("aParamType", CLevelParserParamUPtr{new CLevelParserParam(m_type)}); line->AddParam("aParamType", CLevelParserParamUPtr{new CLevelParserParam(m_type)});
line->AddParam("aParamValue1", CLevelParserParamUPtr{new CLevelParserParam(m_value)}); line->AddParam("aParamValue1", CLevelParserParamUPtr{new CLevelParserParam(m_value)});
line->AddParam("aParamString", CLevelParserParamUPtr{new CLevelParserParam(std::string(m_string))}); line->AddParam("aParamString", CLevelParserParamUPtr{new CLevelParserParam(m_alienProgramName)});
return true; return true;
} }
@ -329,7 +323,7 @@ bool CAutoEgg::Read(CLevelParserLine* line)
m_speed = line->GetParam("aSpeed")->AsFloat(1.0f); m_speed = line->GetParam("aSpeed")->AsFloat(1.0f);
m_type = line->GetParam("aParamType")->AsObjectType(OBJECT_NULL); m_type = line->GetParam("aParamType")->AsObjectType(OBJECT_NULL);
m_value = line->GetParam("aParamValue1")->AsFloat(0.0f); m_value = line->GetParam("aParamValue1")->AsFloat(0.0f);
strcpy(m_string, line->GetParam("aParamString")->AsString("").c_str()); m_alienProgramName = line->GetParam("aParamString")->AsString("");
return true; return true;
} }

View File

@ -25,6 +25,8 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoEggPhase enum AutoEggPhase
{ {
AEP_NULL = 0, AEP_NULL = 0,
@ -39,23 +41,25 @@ enum AutoEggPhase
class CAutoEgg : public CAuto class CAutoEgg : public CAuto
{ {
public: public:
CAutoEgg(CObject* object); CAutoEgg(COldObject* object);
~CAutoEgg(); ~CAutoEgg();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false) override;
void Init(); void Init() override;
void Start(int param); void Start(int param) override;
bool EventProcess(const Event &event); bool EventProcess(const Event &event) override;
Error IsEnded(); Error IsEnded() override;
Error GetError(); Error GetError() override;
bool SetType(ObjectType type); bool SetType(ObjectType type) override;
bool SetValue(int rank, float value); bool SetValue(int rank, float value) override;
bool SetString(char *string); //! Sets program which will be run by created aliens
// TODO: rename to be more meanigful
bool SetString(char* string) override;
bool Write(CLevelParserLine* line); bool Write(CLevelParserLine* line) override;
bool Read(CLevelParserLine* line); bool Read(CLevelParserLine* line) override;
protected: protected:
CObject* SearchAlien(); CObject* SearchAlien();
@ -63,7 +67,7 @@ protected:
protected: protected:
ObjectType m_type; ObjectType m_type;
float m_value; float m_value;
char m_string[100]; std::string m_alienProgramName;
int m_param; int m_param;
AutoEggPhase m_phase; AutoEggPhase m_phase;
float m_progress; float m_progress;

View File

@ -25,6 +25,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/brain.h" #include "object/brain.h"
#include "object/old_object.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/robotmain.h" #include "object/robotmain.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
@ -39,14 +40,11 @@
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoFactory::CAutoFactory(CObject* object) : CAuto(object) CAutoFactory::CAutoFactory(COldObject* object) : CAuto(object)
{ {
Init(); Init();
m_type = OBJECT_MOBILEws; m_type = OBJECT_MOBILEws;

View File

@ -24,7 +24,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoFactoryPhase enum AutoFactoryPhase
{ {
@ -42,7 +42,7 @@ enum AutoFactoryPhase
class CAutoFactory : public CAuto class CAutoFactory : public CAuto
{ {
public: public:
CAutoFactory(CObject* object); CAutoFactory(COldObject* object);
~CAutoFactory(); ~CAutoFactory();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -20,10 +20,11 @@
#include "object/auto/autoflag.h" #include "object/auto/autoflag.h"
#include "math/geometry.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
#include <stdio.h> #include "math/geometry.h"
#include "object/old_object.h"
@ -39,7 +40,7 @@ static float g_flag3 = 2.00f;
// Object's constructor. // Object's constructor.
CAutoFlag::CAutoFlag(CObject* object) : CAuto(object) CAutoFlag::CAutoFlag(COldObject* object) : CAuto(object)
{ {
Init(); Init();
} }

View File

@ -29,7 +29,7 @@
class CAutoFlag : public CAuto class CAutoFlag : public CAuto
{ {
public: public:
CAutoFlag(CObject* object); CAutoFlag(COldObject* object);
~CAutoFlag(); ~CAutoFlag();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -20,15 +20,15 @@
#include "object/auto/autohouston.h" #include "object/auto/autohouston.h"
#include "object/old_object.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
// Object's constructor. // Object's constructor.
CAutoHouston::CAutoHouston(CObject* object) : CAuto(object) CAutoHouston::CAutoHouston(COldObject* object) : CAuto(object)
{ {
Math::Vector pos; Math::Vector pos;
int i; int i;

View File

@ -44,7 +44,7 @@ const int HUSTONMAXLENS = 20;
class CAutoHouston : public CAuto class CAutoHouston : public CAuto
{ {
public: public:
CAutoHouston(CObject* object); CAutoHouston(COldObject* object);
~CAutoHouston(); ~CAutoHouston();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -20,12 +20,12 @@
#include "object/auto/autojostle.h" #include "object/auto/autojostle.h"
#include <stdio.h> #include "object/old_object.h"
// Object's constructor. // Object's constructor.
CAutoJostle::CAutoJostle(CObject* object) : CAuto(object) CAutoJostle::CAutoJostle(COldObject* object) : CAuto(object)
{ {
Init(); Init();
} }

View File

@ -29,7 +29,7 @@
class CAutoJostle : public CAuto class CAutoJostle : public CAuto
{ {
public: public:
CAutoJostle(CObject* object); CAutoJostle(COldObject* object);
~CAutoJostle(); ~CAutoJostle();
void DeleteObject(bool bAll=false) override; void DeleteObject(bool bAll=false) override;

View File

@ -26,6 +26,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/robotmain.h" #include "object/robotmain.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
@ -34,8 +35,6 @@
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
const float LABO_DELAY = 20.0f; // duration of the analysis const float LABO_DELAY = 20.0f; // duration of the analysis
@ -45,11 +44,9 @@ const float LABO_DELAY = 20.0f; // duration of the analysis
// Object's constructor. // Object's constructor.
CAutoLabo::CAutoLabo(CObject* object) : CAuto(object) CAutoLabo::CAutoLabo(COldObject* object) : CAuto(object)
{ {
int i; for (int i = 0; i < 3; i++)
for ( i=0 ; i<3 ; i++ )
{ {
m_partiRank[i] = -1; m_partiRank[i] = -1;
} }
@ -59,7 +56,6 @@ CAutoLabo::CAutoLabo(CObject* object) : CAuto(object)
Init(); Init();
assert(m_object->Implements(ObjectInterfaceType::Powered)); assert(m_object->Implements(ObjectInterfaceType::Powered));
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
} }
// Object's destructor. // Object's destructor.
@ -73,9 +69,7 @@ CAutoLabo::~CAutoLabo()
void CAutoLabo::DeleteObject(bool bAll) void CAutoLabo::DeleteObject(bool bAll)
{ {
int i; for (int i = 0; i < 3; i++)
for ( i=0 ; i<3 ; i++ )
{ {
if ( m_partiRank[i] != -1 ) if ( m_partiRank[i] != -1 )
{ {
@ -133,7 +127,7 @@ Error CAutoLabo::StartAction(int param)
return ERR_LABO_ALREADY; return ERR_LABO_ALREADY;
} }
CObject* power = m_poweredObject->GetPower(); CObject* power = m_object->GetPower();
if (power == nullptr) if (power == nullptr)
{ {
return ERR_LABO_NULL; return ERR_LABO_NULL;
@ -305,7 +299,7 @@ bool CAutoLabo::EventProcess(const Event &event)
{ {
if ( m_progress < 1.0f ) if ( m_progress < 1.0f )
{ {
power = m_poweredObject->GetPower(); power = m_object->GetPower();
if ( power != 0 ) if ( power != 0 )
{ {
power->SetZoom(0, 1.0f-m_progress); power->SetZoom(0, 1.0f-m_progress);
@ -366,10 +360,10 @@ bool CAutoLabo::EventProcess(const Event &event)
m_eventQueue->AddEvent(newEvent); m_eventQueue->AddEvent(newEvent);
UpdateInterface(); UpdateInterface();
power = m_poweredObject->GetPower(); power = m_object->GetPower();
if ( power != nullptr ) if ( power != nullptr )
{ {
m_poweredObject->SetPower(nullptr); m_object->SetPower(nullptr);
CObjectManager::GetInstancePointer()->DeleteObject(power); CObjectManager::GetInstancePointer()->DeleteObject(power);
} }
@ -457,7 +451,7 @@ Error CAutoLabo::GetError()
return ERR_BAT_VIRUS; return ERR_BAT_VIRUS;
} }
CObject* obj = m_poweredObject->GetPower(); CObject* obj = m_object->GetPower();
if (obj == nullptr) return ERR_LABO_NULL; if (obj == nullptr) return ERR_LABO_NULL;
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
if ( type != OBJECT_BULLET ) return ERR_LABO_BAD; if ( type != OBJECT_BULLET ) return ERR_LABO_BAD;

View File

@ -44,7 +44,7 @@ enum AutoLaboPhase
class CAutoLabo : public CAuto class CAutoLabo : public CAuto
{ {
public: public:
CAutoLabo(CObject* object); CAutoLabo(COldObject* object);
~CAutoLabo(); ~CAutoLabo();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);
@ -67,7 +67,6 @@ protected:
void SoundManip(float time, float amplitude, float frequency); void SoundManip(float time, float amplitude, float frequency);
protected: protected:
CPoweredObject* m_poweredObject;
AutoLaboPhase m_phase; AutoLaboPhase m_phase;
float m_progress; float m_progress;
float m_speed; float m_speed;

View File

@ -21,18 +21,15 @@
#include "object/auto/automush.h" #include "object/auto/automush.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoMush::CAutoMush(CObject* object) : CAuto(object) CAutoMush::CAutoMush(COldObject* object) : CAuto(object)
{ {
Init(); Init();
} }

View File

@ -40,7 +40,7 @@ enum AutoMushPhase
class CAutoMush : public CAuto class CAutoMush : public CAuto
{ {
public: public:
CAutoMush(CObject* object); CAutoMush(COldObject* object);
~CAutoMush(); ~CAutoMush();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -23,17 +23,14 @@
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoNest::CAutoNest(CObject* object) : CAuto(object) CAutoNest::CAutoNest(COldObject* object) : CAuto(object)
{ {
Init(); Init();
} }

View File

@ -25,6 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoNestPhase enum AutoNestPhase
{ {
@ -37,7 +38,7 @@ enum AutoNestPhase
class CAutoNest : public CAuto class CAutoNest : public CAuto
{ {
public: public:
CAutoNest(CObject* object); CAutoNest(COldObject* object);
~CAutoNest(); ~CAutoNest();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -23,6 +23,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "object/interface/powered_object.h" #include "object/interface/powered_object.h"
@ -31,9 +32,6 @@
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
const float NUCLEARPLANT_DELAY = 30.0f; // duration of the generation const float NUCLEARPLANT_DELAY = 30.0f; // duration of the generation
@ -42,13 +40,12 @@ const float NUCLEARPLANT_DELAY = 30.0f; // duration of the generation
// Object's constructor. // Object's constructor.
CAutoNuclearPlant::CAutoNuclearPlant(CObject* object) : CAuto(object) CAutoNuclearPlant::CAutoNuclearPlant(COldObject* object) : CAuto(object)
{ {
m_channelSound = -1; m_channelSound = -1;
Init(); Init();
assert(m_object->Implements(ObjectInterfaceType::Powered)); assert(m_object->Implements(ObjectInterfaceType::Powered));
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
} }
// Object's destructor. // Object's destructor.
@ -234,7 +231,7 @@ bool CAutoNuclearPlant::EventProcess(const Event &event)
if ( cargo != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(cargo); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
m_poweredObject->SetPower(nullptr); m_object->SetPower(nullptr);
} }
CreatePower(); // creates the atomic cell CreatePower(); // creates the atomic cell
@ -322,7 +319,7 @@ bool CAutoNuclearPlant::CreateInterface(bool bSelect)
CObject* CAutoNuclearPlant::SearchUranium() CObject* CAutoNuclearPlant::SearchUranium()
{ {
CObject* obj = m_poweredObject->GetPower(); CObject* obj = m_object->GetPower();
if (obj == nullptr) return nullptr; if (obj == nullptr) return nullptr;
if (obj->GetType() == OBJECT_URANIUM) return obj; if (obj->GetType() == OBJECT_URANIUM) return obj;
return nullptr; return nullptr;
@ -391,7 +388,7 @@ void CAutoNuclearPlant::CreatePower()
dynamic_cast<CTransportableObject*>(power)->SetTransporter(m_object); dynamic_cast<CTransportableObject*>(power)->SetTransporter(m_object);
power->SetPosition(0, Math::Vector(22.0f, 3.0f, 0.0f)); power->SetPosition(0, Math::Vector(22.0f, 3.0f, 0.0f));
m_poweredObject->SetPower(power); m_object->SetPower(power);
} }
@ -411,7 +408,7 @@ Error CAutoNuclearPlant::GetError()
//? if ( m_object->GetEnergy() < ENERGY_POWER ) return ERR_NUCLEAR_LOW; //? if ( m_object->GetEnergy() < ENERGY_POWER ) return ERR_NUCLEAR_LOW;
CObject* obj = m_poweredObject->GetPower(); CObject* obj = m_object->GetPower();
if ( obj == nullptr ) return ERR_NUCLEAR_EMPTY; if ( obj == nullptr ) return ERR_NUCLEAR_EMPTY;
if ( obj->GetLock() ) return ERR_OK; if ( obj->GetLock() ) return ERR_OK;
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();

View File

@ -25,7 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CPoweredObject; class CObject;
enum AutoNuclearPlantPhase enum AutoNuclearPlantPhase
{ {
@ -41,7 +41,7 @@ enum AutoNuclearPlantPhase
class CAutoNuclearPlant : public CAuto class CAutoNuclearPlant : public CAuto
{ {
public: public:
CAutoNuclearPlant(CObject* object); CAutoNuclearPlant(COldObject* object);
~CAutoNuclearPlant(); ~CAutoNuclearPlant();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);
@ -61,7 +61,6 @@ protected:
void CreatePower(); void CreatePower();
protected: protected:
CPoweredObject* m_poweredObject;
AutoNuclearPlantPhase m_phase; AutoNuclearPlantPhase m_phase;
float m_progress; float m_progress;
float m_speed; float m_speed;

View File

@ -22,9 +22,7 @@
#include "object/robotmain.h" #include "object/robotmain.h"
#include "object/old_object.h"
#include <stdio.h>
#include <string.h>
const int PARAM_DEPOSE = 2; // run=2 -> deposits the spaceship const int PARAM_DEPOSE = 2; // run=2 -> deposits the spaceship
@ -57,7 +55,7 @@ float Progress(float a, float b, float progress)
// Object's constructor. // Object's constructor.
CAutoPortico::CAutoPortico(CObject* object) : CAuto(object) CAutoPortico::CAutoPortico(COldObject* object) : CAuto(object)
{ {
Init(); Init();
m_phase = APOP_WAIT; m_phase = APOP_WAIT;
@ -398,10 +396,7 @@ Error CAutoPortico::GetError()
void CAutoPortico::UpdateTrackMapping(float left, float right) void CAutoPortico::UpdateTrackMapping(float left, float right)
{ {
Gfx::Material mat; Gfx::Material mat;
int rank;
memset( &mat, 0, sizeof(Gfx::Material));
mat.diffuse.r = 1.0f; mat.diffuse.r = 1.0f;
mat.diffuse.g = 1.0f; mat.diffuse.g = 1.0f;
mat.diffuse.b = 1.0f; // blank mat.diffuse.b = 1.0f; // blank
@ -409,7 +404,7 @@ void CAutoPortico::UpdateTrackMapping(float left, float right)
mat.ambient.g = 0.5f; mat.ambient.g = 0.5f;
mat.ambient.b = 0.5f; mat.ambient.b = 0.5f;
rank = m_object->GetObjectRank(0); int rank = m_object->GetObjectRank(0);
m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART1, "objects/lemt.png", "", m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART1, "objects/lemt.png", "",
Gfx::ENG_TEX_MAPPING_X, Gfx::ENG_TEX_MAPPING_X,

View File

@ -42,7 +42,7 @@ enum AutoPorticoPhase
class CAutoPortico : public CAuto class CAutoPortico : public CAuto
{ {
public: public:
CAutoPortico(CObject* object); CAutoPortico(COldObject* object);
~CAutoPortico(); ~CAutoPortico();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -24,6 +24,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "object/interface/carrier_object.h" #include "object/interface/carrier_object.h"
@ -33,14 +34,11 @@
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoPowerCaptor::CAutoPowerCaptor(CObject* object) : CAuto(object) CAutoPowerCaptor::CAutoPowerCaptor(COldObject* object) : CAuto(object)
{ {
m_channelSound = -1; m_channelSound = -1;
Init(); Init();

View File

@ -38,7 +38,7 @@ enum AutoPowerCaptorPhase
class CAutoPowerCaptor : public CAuto class CAutoPowerCaptor : public CAuto
{ {
public: public:
CAutoPowerCaptor(CObject* object); CAutoPowerCaptor(COldObject* object);
~CAutoPowerCaptor(); ~CAutoPowerCaptor();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -25,6 +25,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/interface/powered_object.h" #include "object/interface/powered_object.h"
#include "object/interface/transportable_object.h" #include "object/interface/transportable_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
@ -34,9 +35,6 @@
#include "ui/gauge.h" #include "ui/gauge.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
const float POWERPLANT_POWER = 0.4f; // Necessary energy for a battery const float POWERPLANT_POWER = 0.4f; // Necessary energy for a battery
const float POWERPLANT_DELAY = 12.0f; // processing time const float POWERPLANT_DELAY = 12.0f; // processing time
@ -46,13 +44,12 @@ const float POWERPLANT_DELAY = 12.0f; // processing time
// Object's constructor. // Object's constructor.
CAutoPowerPlant::CAutoPowerPlant(CObject* object) : CAuto(object) CAutoPowerPlant::CAutoPowerPlant(COldObject* object) : CAuto(object)
{ {
m_partiSphere = -1; m_partiSphere = -1;
Init(); Init();
assert(m_object->Implements(ObjectInterfaceType::Powered)); assert(m_object->Implements(ObjectInterfaceType::Powered));
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
} }
// Object's destructor. // Object's destructor.
@ -313,7 +310,7 @@ bool CAutoPowerPlant::EventProcess(const Event &event)
cargo = SearchMetal(); cargo = SearchMetal();
if ( cargo != nullptr ) if ( cargo != nullptr )
{ {
m_poweredObject->SetPower(nullptr); m_object->SetPower(nullptr);
CObjectManager::GetInstancePointer()->DeleteObject(cargo); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
@ -326,7 +323,7 @@ bool CAutoPowerPlant::EventProcess(const Event &event)
cargo->SetLock(false); // usable battery cargo->SetLock(false); // usable battery
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(m_object); dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(m_object);
cargo->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f)); cargo->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f));
m_poweredObject->SetPower(cargo); m_object->SetPower(cargo);
m_main->DisplayError(INFO_ENERGY, m_object); m_main->DisplayError(INFO_ENERGY, m_object);
} }
@ -380,7 +377,7 @@ bool CAutoPowerPlant::EventProcess(const Event &event)
CObject* CAutoPowerPlant::SearchMetal() CObject* CAutoPowerPlant::SearchMetal()
{ {
CObject* obj = m_poweredObject->GetPower(); CObject* obj = m_object->GetPower();
if ( obj == nullptr ) return nullptr; if ( obj == nullptr ) return nullptr;
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
@ -502,7 +499,7 @@ Error CAutoPowerPlant::GetError()
if ( m_object->GetEnergy() < POWERPLANT_POWER ) return ERR_ENERGY_LOW; if ( m_object->GetEnergy() < POWERPLANT_POWER ) return ERR_ENERGY_LOW;
CObject* obj = m_poweredObject->GetPower(); CObject* obj = m_object->GetPower();
if (obj == nullptr) return ERR_ENERGY_EMPTY; if (obj == nullptr) return ERR_ENERGY_EMPTY;
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
if ( type == OBJECT_POWER ) return ERR_OK; if ( type == OBJECT_POWER ) return ERR_OK;

View File

@ -25,7 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CPoweredObject; class CObject;
enum AutoPowerPlantPhase enum AutoPowerPlantPhase
@ -42,7 +42,7 @@ enum AutoPowerPlantPhase
class CAutoPowerPlant : public CAuto class CAutoPowerPlant : public CAuto
{ {
public: public:
CAutoPowerPlant(CObject* object); CAutoPowerPlant(COldObject* object);
~CAutoPowerPlant(); ~CAutoPowerPlant();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);
@ -65,7 +65,6 @@ protected:
CObject* SearchPower(); CObject* SearchPower();
protected: protected:
CPoweredObject* m_poweredObject;
AutoPowerPlantPhase m_phase; AutoPowerPlantPhase m_phase;
float m_progress; float m_progress;
float m_speed; float m_speed;

View File

@ -26,6 +26,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/interface/carrier_object.h" #include "object/interface/carrier_object.h"
#include "object/interface/powered_object.h" #include "object/interface/powered_object.h"
@ -33,12 +34,11 @@
#include "ui/gauge.h" #include "ui/gauge.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
// Object's constructor. // Object's constructor.
CAutoPowerStation::CAutoPowerStation(CObject* object) : CAuto(object) CAutoPowerStation::CAutoPowerStation(COldObject* object) : CAuto(object)
{ {
Init(); Init();
} }

View File

@ -24,12 +24,13 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
class CAutoPowerStation : public CAuto class CAutoPowerStation : public CAuto
{ {
public: public:
CAutoPowerStation(CObject* object); CAutoPowerStation(COldObject* object);
~CAutoPowerStation(); ~CAutoPowerStation();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -23,17 +23,17 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include "ui/gauge.h" #include "ui/gauge.h"
#include <stdio.h>
// Object's constructor. // Object's constructor.
CAutoRadar::CAutoRadar(CObject* object) : CAuto(object) CAutoRadar::CAutoRadar(COldObject* object) : CAuto(object)
{ {
Init(); Init();
m_phase = ARAP_WAIT; m_phase = ARAP_WAIT;

View File

@ -39,7 +39,7 @@ enum AutoRadarPhase
class CAutoRadar : public CAuto class CAutoRadar : public CAuto
{ {
public: public:
CAutoRadar(CObject* object); CAutoRadar(COldObject* object);
~CAutoRadar(); ~CAutoRadar();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -21,22 +21,20 @@
#include "object/auto/autorepair.h" #include "object/auto/autorepair.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "physics/physics.h" #include "physics/physics.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
// Object's constructor. // Object's constructor.
CAutoRepair::CAutoRepair(CObject* object) : CAuto(object) CAutoRepair::CAutoRepair(COldObject* object) : CAuto(object)
{ {
Init(); Init();
m_phase = ARP_WAIT; // paused until the first Init () m_phase = ARP_WAIT; // paused until the first Init ()

View File

@ -25,6 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoRepairPhase enum AutoRepairPhase
{ {
@ -40,7 +41,7 @@ enum AutoRepairPhase
class CAutoRepair : public CAuto class CAutoRepair : public CAuto
{ {
public: public:
CAutoRepair(CObject* object); CAutoRepair(COldObject* object);
~CAutoRepair(); ~CAutoRepair();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -25,6 +25,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/robotmain.h" #include "object/robotmain.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "object/interface/powered_object.h" #include "object/interface/powered_object.h"
@ -33,9 +34,6 @@
#include "ui/gauge.h" #include "ui/gauge.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
const float SEARCH_TIME = 30.0f; // duration of a research const float SEARCH_TIME = 30.0f; // duration of a research
@ -43,7 +41,7 @@ const float SEARCH_TIME = 30.0f; // duration of a research
// Object's constructor. // Object's constructor.
CAutoResearch::CAutoResearch(CObject* object) : CAuto(object) CAutoResearch::CAutoResearch(COldObject* object) : CAuto(object)
{ {
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@ -54,7 +52,6 @@ CAutoResearch::CAutoResearch(CObject* object) : CAuto(object)
Init(); Init();
assert(m_object->Implements(ObjectInterfaceType::Powered)); assert(m_object->Implements(ObjectInterfaceType::Powered));
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
} }
// Object's destructor. // Object's destructor.
@ -111,7 +108,7 @@ Error CAutoResearch::StartAction(int param)
return ERR_RESEARCH_ALREADY; return ERR_RESEARCH_ALREADY;
} }
CObject* power = m_poweredObject->GetPower(); CObject* power = m_object->GetPower();
if (power == nullptr) if (power == nullptr)
{ {
return ERR_RESEARCH_POWER; return ERR_RESEARCH_POWER;
@ -218,7 +215,7 @@ bool CAutoResearch::EventProcess(const Event &event)
FireStopUpdate(m_progress, true); // flashes FireStopUpdate(m_progress, true); // flashes
if ( m_progress < 1.0f ) if ( m_progress < 1.0f )
{ {
power = m_poweredObject->GetPower(); power = m_object->GetPower();
if ( power == 0 ) // more battery? if ( power == 0 ) // more battery?
{ {
SetBusy(false); SetBusy(false);
@ -300,7 +297,7 @@ Error CAutoResearch::GetError()
return ERR_BAT_VIRUS; return ERR_BAT_VIRUS;
} }
CObject* power = m_poweredObject->GetPower(); CObject* power = m_object->GetPower();
if ( power == 0 ) if ( power == 0 )
{ {
return ERR_RESEARCH_POWER; return ERR_RESEARCH_POWER;

View File

@ -25,8 +25,6 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CPoweredObject;
enum AutoResearchPhase enum AutoResearchPhase
{ {
ALP_WAIT = 1, ALP_WAIT = 1,
@ -38,7 +36,7 @@ enum AutoResearchPhase
class CAutoResearch : public CAuto class CAutoResearch : public CAuto
{ {
public: public:
CAutoResearch(CObject* object); CAutoResearch(COldObject* object);
~CAutoResearch(); ~CAutoResearch();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);
@ -61,7 +59,6 @@ protected:
void FireStopUpdate(float progress, bool bLightOn); void FireStopUpdate(float progress, bool bLightOn);
protected: protected:
CPoweredObject* m_poweredObject;
AutoResearchPhase m_phase; AutoResearchPhase m_phase;
float m_progress; float m_progress;
float m_speed; float m_speed;

View File

@ -23,14 +23,15 @@
#include "graphics/engine/particle.h" #include "graphics/engine/particle.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
#include "object/old_object.h"
#include "math/geometry.h" #include "math/geometry.h"
#include <stdio.h>
// Object's constructor. // Object's constructor.
CAutoRoot::CAutoRoot(CObject* object) : CAuto(object) CAutoRoot::CAutoRoot(COldObject* object) : CAuto(object)
{ {
Init(); Init();
} }

View File

@ -29,7 +29,7 @@
class CAutoRoot : public CAuto class CAutoRoot : public CAuto
{ {
public: public:
CAutoRoot(CObject* object); CAutoRoot(COldObject* object);
~CAutoRoot(); ~CAutoRoot();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);

View File

@ -23,20 +23,17 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
#include "object/interface/powered_object.h" #include "object/interface/powered_object.h"
#include "physics/physics.h" #include "physics/physics.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include "ui/gauge.h" #include "ui/gauge.h"
#include <stdio.h>
#include <string.h>
const float TOWER_SCOPE = 200.0f; // range of beam const float TOWER_SCOPE = 200.0f; // range of beam
const float ENERGY_FIRE = 0.125f; // energy consumed by fire const float ENERGY_FIRE = 0.125f; // energy consumed by fire
@ -44,7 +41,7 @@ const float ENERGY_FIRE = 0.125f; // energy consumed by fire
// Object's constructor. // Object's constructor.
CAutoTower::CAutoTower(CObject* object) : CAuto(object) CAutoTower::CAutoTower(COldObject* object) : CAuto(object)
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
@ -57,7 +54,6 @@ CAutoTower::CAutoTower(CObject* object) : CAuto(object)
m_lastUpdateTime = 0.0f; m_lastUpdateTime = 0.0f;
assert(m_object->Implements(ObjectInterfaceType::Powered)); assert(m_object->Implements(ObjectInterfaceType::Powered));
m_poweredObject = dynamic_cast<CPoweredObject*>(m_object);
} }
// Object's destructor. // Object's destructor.
@ -134,7 +130,7 @@ bool CAutoTower::EventProcess(const Event &event)
if ( m_progress < 1.0f ) if ( m_progress < 1.0f )
{ {
energy = 0.0f; energy = 0.0f;
power = m_poweredObject->GetPower(); power = m_object->GetPower();
if ( power != 0 ) if ( power != 0 )
{ {
energy = power->GetEnergy()*power->GetCapacity(); energy = power->GetEnergy()*power->GetCapacity();
@ -174,7 +170,7 @@ bool CAutoTower::EventProcess(const Event &event)
else else
{ {
energy = 0.0f; energy = 0.0f;
power = m_poweredObject->GetPower(); power = m_object->GetPower();
if ( power != 0 ) if ( power != 0 )
{ {
energy = power->GetEnergy()*power->GetCapacity(); energy = power->GetEnergy()*power->GetCapacity();
@ -227,7 +223,7 @@ bool CAutoTower::EventProcess(const Event &event)
m_object->SetAngleY(1, m_angleYfinal); m_object->SetAngleY(1, m_angleYfinal);
m_object->SetAngleZ(2, m_angleZfinal); m_object->SetAngleZ(2, m_angleZfinal);
power = m_poweredObject->GetPower(); power = m_object->GetPower();
if ( power != 0 ) if ( power != 0 )
{ {
energy = power->GetEnergy(); energy = power->GetEnergy();
@ -321,7 +317,7 @@ Error CAutoTower::GetError()
return ERR_BAT_VIRUS; return ERR_BAT_VIRUS;
} }
CObject* power = m_poweredObject->GetPower(); CObject* power = m_object->GetPower();
if ( power == nullptr ) if ( power == nullptr )
{ {
return ERR_TOWER_POWER; // no battery return ERR_TOWER_POWER; // no battery

View File

@ -25,7 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CPoweredObject; class CObject;
enum AutoTowerPhase enum AutoTowerPhase
{ {
@ -41,7 +41,7 @@ enum AutoTowerPhase
class CAutoTower : public CAuto class CAutoTower : public CAuto
{ {
public: public:
CAutoTower(CObject* object); CAutoTower(COldObject* object);
~CAutoTower(); ~CAutoTower();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);
@ -62,7 +62,6 @@ protected:
void FireStopUpdate(float progress, bool bLightOn); void FireStopUpdate(float progress, bool bLightOn);
protected: protected:
CPoweredObject* m_poweredObject;
AutoTowerPhase m_phase; AutoTowerPhase m_phase;
float m_progress; float m_progress;
float m_speed; float m_speed;

View File

@ -23,6 +23,7 @@
#include "math/geometry.h" #include "math/geometry.h"
#include "object/object_manager.h" #include "object/object_manager.h"
#include "object/old_object.h"
#include "object/robotmain.h" #include "object/robotmain.h"
#include "object/level/parserline.h" #include "object/level/parserline.h"
#include "object/level/parserparam.h" #include "object/level/parserparam.h"
@ -31,20 +32,15 @@
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/window.h" #include "ui/window.h"
#include <stdio.h>
#include <string.h>
const float OPEN_DELAY = 8.0f; // duration of opening const float OPEN_DELAY = 8.0f; // duration of opening
// Object's constructor. // Object's constructor.
CAutoVault::CAutoVault(CObject* object) : CAuto(object) CAutoVault::CAutoVault(COldObject* object) : CAuto(object)
{ {
int i; for (int i = 0; i < 4; i++)
for ( i=0 ; i<4 ; i++ )
{ {
m_bKey[i] = false; m_bKey[i] = false;
m_keyParti[i] = -1; m_keyParti[i] = -1;

View File

@ -25,6 +25,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
class CObject;
enum AutoVaultPhase enum AutoVaultPhase
{ {
@ -38,7 +39,7 @@ enum AutoVaultPhase
class CAutoVault : public CAuto class CAutoVault : public CAuto
{ {
public: public:
CAutoVault(CObject* object); CAutoVault(COldObject* object);
~CAutoVault(); ~CAutoVault();
void DeleteObject(bool bAll=false); void DeleteObject(bool bAll=false);